groundhog-postgresql 0.9.0.1 → 0.10
raw patch · 6 files changed
+63/−59 lines, 6 filesdep ~groundhogPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: groundhog
API changes (from Hackage documentation)
- Database.Groundhog.Postgresql: castType :: Expression Postgresql r a => a -> String -> Expr Postgresql r a
+ Database.Groundhog.Postgresql: castType :: (Expression Postgresql r a, PersistField a) => a -> String -> Expr Postgresql r a
- Database.Groundhog.Postgresql.Array: (!) :: (ExpressionOf Postgresql r a (Array elem), ExpressionOf Postgresql r b Int) => a -> b -> Expr Postgresql r elem
+ Database.Groundhog.Postgresql.Array: (!) :: (ExpressionOf Postgresql r a (Array elem), ExpressionOf Postgresql r b Int, PersistField elem) => a -> b -> Expr Postgresql r elem
- Database.Groundhog.Postgresql.Array: arrayDims :: (ExpressionOf Postgresql r a (Array elem)) => a -> Expr Postgresql r String
+ Database.Groundhog.Postgresql.Array: arrayDims :: ExpressionOf Postgresql r a (Array elem) => a -> Expr Postgresql r String
- Database.Groundhog.Postgresql.Array: arrayLength :: (ExpressionOf Postgresql r a (Array elem)) => a -> Int -> Expr Postgresql r Int
+ Database.Groundhog.Postgresql.Array: arrayLength :: ExpressionOf Postgresql r a (Array elem) => a -> Int -> Expr Postgresql r Int
- Database.Groundhog.Postgresql.Array: arrayLower :: (ExpressionOf Postgresql r a (Array elem)) => a -> Int -> Expr Postgresql r Int
+ Database.Groundhog.Postgresql.Array: arrayLower :: ExpressionOf Postgresql r a (Array elem) => a -> Int -> Expr Postgresql r Int
- Database.Groundhog.Postgresql.Array: arrayNDims :: (ExpressionOf Postgresql r a (Array elem)) => a -> Expr Postgresql r Int
+ Database.Groundhog.Postgresql.Array: arrayNDims :: ExpressionOf Postgresql r a (Array elem) => a -> Expr Postgresql r Int
- Database.Groundhog.Postgresql.Array: arrayToString :: (ExpressionOf Postgresql r a (Array elem)) => a -> String -> Expr Postgresql r String
+ Database.Groundhog.Postgresql.Array: arrayToString :: ExpressionOf Postgresql r a (Array elem) => a -> String -> Expr Postgresql r String
- Database.Groundhog.Postgresql.Array: arrayUpper :: (ExpressionOf Postgresql r a (Array elem)) => a -> Int -> Expr Postgresql r Int
+ Database.Groundhog.Postgresql.Array: arrayUpper :: ExpressionOf Postgresql r a (Array elem) => a -> Int -> Expr Postgresql r Int
- Database.Groundhog.Postgresql.Array: stringToArray :: (ExpressionOf Postgresql r a String) => a -> String -> Expr Postgresql r (Array String)
+ Database.Groundhog.Postgresql.Array: stringToArray :: ExpressionOf Postgresql r a String => a -> String -> Expr Postgresql r (Array String)
- Database.Groundhog.Postgresql.HStore: HStore :: (Map Text Text) -> HStore
+ Database.Groundhog.Postgresql.HStore: HStore :: Map Text Text -> HStore
Files
- Database/Groundhog/Postgresql.hs +8/−8
- Database/Groundhog/Postgresql/Array.hs +3/−3
- Database/Groundhog/Postgresql/Geometry.hs +25/−25
- Database/Groundhog/Postgresql/HStore.hs +21/−21
- changelog +4/−0
- groundhog-postgresql.cabal +2/−2
Database/Groundhog/Postgresql.hs view
@@ -277,7 +277,7 @@ go _ [] = return () go 0 l return $ fromPrimitivePersistValue k- + getList' :: forall a . PersistField a => Int64 -> Action Postgresql [a] getList' k = do let mainName = "List" <> delim' <> delim' <> fromString (persistName (undefined :: a))@@ -386,7 +386,7 @@ -- this can happen when an ephemeral field was added or removed. else [DropTrigger trigName tName, addTrigger]) return (trigExisted, funcMig ++ trigMig)- + -- | Table name and a list of field names and according delete statements -- assume that this function is called only for ephemeral fields migTriggerOnUpdate :: QualifiedName -> [(String, String)] -> Action Postgresql [(Bool, [AlterDB])]@@ -414,7 +414,7 @@ -- this can happen when an ephemeral field was added or removed. else [DropTrigger trigName tName, addTrigger]) return (trigExisted, funcMig ++ trigMig)- + analyzeTable' :: QualifiedName -> Action Postgresql (Maybe TableInfo) analyzeTable' name = do table <- queryRaw' "SELECT * FROM information_schema.tables WHERE table_schema = coalesce(?, current_schema()) AND table_name = ?" (toPurePersistValues name []) >>= firstRow@@ -432,7 +432,7 @@ cols <- queryRaw' colQuery (toPurePersistValues name []) >>= mapStream (return . getColumn . fst . fromPurePersistValues) >>= streamToList let constraintQuery = "SELECT u.constraint_name, u.column_name FROM information_schema.table_constraints tc INNER JOIN information_schema.constraint_column_usage u ON tc.constraint_catalog=u.constraint_catalog AND tc.constraint_schema=u.constraint_schema AND tc.constraint_name=u.constraint_name WHERE tc.constraint_type=? AND tc.table_schema=coalesce(?,current_schema()) AND u.table_name=? ORDER BY u.constraint_name, u.column_name"- + uniqConstraints <- queryRaw' constraintQuery (toPurePersistValues ("UNIQUE" :: String, name) []) >>= mapStream (return . fst . fromPurePersistValues) >>= streamToList uniqPrimary <- queryRaw' constraintQuery (toPurePersistValues ("PRIMARY KEY" :: String, name) []) >>= mapStream (return . fst . fromPurePersistValues) >>= streamToList -- indexes with system columns like oid are omitted@@ -709,7 +709,7 @@ -- It is used to escape table names and columns, which can include only symbols allowed in Haskell datatypes and '$' delimiter. We need it mostly to support names that coincide with SQL keywords escape :: String -> String escape s = '\"' : s ++ "\""- + getStatement :: Utf8 -> PG.Query getStatement sql = PG.Query $ fromUtf8 sql @@ -828,8 +828,8 @@ withSchema (sch, name) = maybe "" (\x -> escape x ++ ".") sch ++ escape name -- | Put explicit type for expression. It is useful for values which are defaulted to a wrong type.--- For example, a literal Int from a 64bit machine can be defaulted to a 32bit int by Postgresql. --- Also a value entered as an external string (geometry, arrays and other complex types have this representation) may need an explicit type. +-- For example, a literal Int from a 64bit machine can be defaulted to a 32bit int by Postgresql.+-- Also a value entered as an external string (geometry, arrays and other complex types have this representation) may need an explicit type. explicitType :: (Expression Postgresql r a, PersistField a) => a -> Expr Postgresql r a explicitType a = castType a t where t = case dbType proxy a of@@ -837,7 +837,7 @@ _ -> error "explicitType: type is not primitive" -- | Casts expression to a type. @castType value \"INT\"@ results in @value::INT@.-castType :: Expression Postgresql r a => a -> String -> Expr Postgresql r a+castType :: (Expression Postgresql r a, PersistField a) => a -> String -> Expr Postgresql r a castType a t = mkExpr $ Snippet $ \conf _ -> ["(" <> renderExpr conf (toExpr a) <> ")::" <> fromString t] where -- | Distinct only on certain fields or expressions. For example, @select $ CondEmpty `distinctOn` (lower EmailField, IpField)@.
Database/Groundhog/Postgresql/Array.hs view
@@ -89,7 +89,7 @@ parseString :: Parser ByteString parseString = (char '"' *> jstring_) <|> takeWhile1 (\c -> c /= ',' && c /= '}') - + -- Borrowed from aeson jstring_ :: Parser ByteString jstring_ = {-# SCC "jstring_" #-} do @@ -131,11 +131,11 @@ doubleQuote, backslash :: Word8 doubleQuote = 34 backslash = 92 - + parseArr :: ArrayElem a => Parser (Array a) parseArr = Array <$> (char '{' *> parseElem `sepBy` char ',' <* char '}') -(!) :: (ExpressionOf Postgresql r a (Array elem), ExpressionOf Postgresql r b Int) => a -> b -> Expr Postgresql r elem +(!) :: (ExpressionOf Postgresql r a (Array elem), ExpressionOf Postgresql r b Int, PersistField elem) => a -> b -> Expr Postgresql r elem (!) arr i = mkExpr $ Snippet $ \conf _ -> [renderExpr conf (toExpr arr) <> "[" <> renderExpr conf (toExpr i) <> "]"] (!:) :: (ExpressionOf Postgresql r a (Array elem), ExpressionOf Postgresql r i1 Int, ExpressionOf Postgresql r i2 Int) => a -> (i1, i2) -> Expr Postgresql r (Array elem)
Database/Groundhog/Postgresql/Geometry.hs view
@@ -251,7 +251,7 @@ instance Intersects Lseg Lseg instance Intersects Path Path -psqlOperatorExpr :: (SqlDb db, Expression db r a, Expression db r b) => String -> a -> b -> Expr db r c +psqlOperatorExpr :: (SqlDb db, Expression db r a, Expression db r b, PersistField c) => String -> a -> b -> Expr db r c psqlOperatorExpr op x y = mkExpr $ operator 50 op x y psqlOperatorCond :: (SqlDb db, Expression db r a, Expression db r b) => String -> a -> b -> Cond db r @@ -263,25 +263,25 @@ infixl 7 *. infixl 7 /. -- | Translation --- +-- -- @box '((0,0),(1,1))' + point '(2.0,0)' = box '(3,1),(2,0)'@ (+.) :: (SqlDb db, Plus a b, ExpressionOf db r x a, ExpressionOf db r y b) => x -> y -> Expr db r a x +. y = mkExpr $ operator 60 "+" x y -- | Translation --- +-- -- @box '((0,0),(1,1))' - point '(2.0,0)' = box '(-1,1),(-2,0)'@ (-.) :: (SqlDb db, BoxCirclePathPoint a, ExpressionOf db r x a, ExpressionOf db r y Point) => x -> y -> Expr db r a x -. y = mkExpr $ operator 60 "-" x y -- | Scaling/rotation --- +-- -- @box '((0,0),(1,1))' * point '(2.0,0)' = box '(2,2),(0,0)'@ (*.) :: (SqlDb db, BoxCirclePathPoint a, ExpressionOf db r x a, ExpressionOf db r y Point) => x -> y -> Expr db r a x *. y = mkExpr $ operator 70 "*" x y -- | Scaling/rotation --- +-- -- @box '((0,0),(2,2))' / point '(2.0,0)' = box '(1,1),(0,0)'@ (/.) :: (SqlDb db, BoxCirclePathPoint a, ExpressionOf db r x a, ExpressionOf db r y Point) => x -> y -> Expr db r a x /. y = mkExpr $ operator 70 "/" x y @@ -295,31 +295,31 @@ (#) = psqlOperatorExpr "#" -- | Closest point to first operand on second operand --- +-- -- @point '(0,0)' ## lseg '((2,0),(0,2))' = point '(1,1)'@ (##) :: (SqlDb db, Closest a b, ExpressionOf db r x a, ExpressionOf db r y b) => x -> y -> Expr db r Point (##) = psqlOperatorExpr "##" -- | Distance between --- +-- -- @circle '((0,0),1)' <-> circle '((5,0),1)' = 3@ (<->) :: (SqlDb db, Distance a b, ExpressionOf db r x a, ExpressionOf db r y b) => x -> y -> Expr db r Double (<->) = psqlOperatorExpr "<->" -- | Overlaps? --- +-- -- @box '((0,0),(1,1))' && box '((0,0),(2,2))' = true@ (&&) :: (SqlDb db, BoxCirclePolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (&&) = psqlOperatorCond "&&" -- | Is strictly left of? --- +-- -- @circle '((0,0),1)' << circle '((5,0),1)' = true@ (<<) :: (SqlDb db, BoxCirclePointPolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (<<) = psqlOperatorCond "<<" -- | Is strictly right of? --- +-- -- @circle '((5,0),1)' >> circle '((0,0),1)' = true@ (>>) :: (SqlDb db, BoxCirclePointPolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (>>) = psqlOperatorCond ">>" @@ -329,91 +329,91 @@ (&<) = psqlOperatorCond "&<" -- | Does not extend to the left of? --- +-- -- @box '((0,0),(3,3))' &> box '((0,0),(2,2))' = true@ (&>) :: (SqlDb db, BoxCirclePolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (&>) = psqlOperatorCond "&>" -- | Is strictly below? --- +-- -- @box '((0,0),(3,3))' <<| box '((3,4),(5,5))' = true@ (<<|) :: (SqlDb db, BoxCirclePolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (<<|) = psqlOperatorCond "<<|" -- | Is strictly above? --- +-- -- @box '((3,4),(5,5))' |>> box '((0,0),(3,3))'@ (|>>):: (SqlDb db, BoxCirclePolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (|>>) = psqlOperatorCond "|>>" -- | Does not extend above? --- +-- -- @box '((0,0),(1,1))' &<| box '((0,0),(2,2))' = true@ (&<|):: (SqlDb db, BoxCirclePolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (&<|) = psqlOperatorCond "&<|" -- | Does not extend below? --- +-- -- @box '((0,0),(3,3))' |&> box '((0,0),(2,2))' = true@ (|&>) :: (SqlDb db, BoxCirclePolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (|&>) = psqlOperatorCond "|&>" -- | Is below (allows touching)? --- +-- -- @circle '((0,0),1)' <^ circle '((0,5),1)' = true@ (<^) :: (SqlDb db, BoxPoint a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (<^) = psqlOperatorCond "<^" -- | Is above (allows touching)? --- +-- -- @circle '((0,5),1)' >^ circle '((0,0),1)' = true@ (>^) :: (SqlDb db, BoxPoint a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (>^) = psqlOperatorCond ">^" -- | Intersects? --- +-- -- @lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))' = true@ (?#) :: (SqlDb db, Intersects a b, ExpressionOf db r x a, ExpressionOf db r y b) => x -> y -> Cond db r (?#) = psqlOperatorCond "?#" -- | Are horizontally aligned? --- +-- -- @point '(1,0)' ?- point '(0,0)' = true@ (?-) :: (SqlDb db, ExpressionOf db r x Point, ExpressionOf db r y Point) => x -> y -> Cond db r (?-) = psqlOperatorCond "?-" -- | Are vertically aligned? --- +-- -- @point '(0,1)' ?| point '(0,0)' = true@ (?|) :: (SqlDb db, ExpressionOf db r x Point, ExpressionOf db r y Point) => x -> y -> Cond db r (?|) = psqlOperatorCond "?|" -- | Is perpendicular? --- +-- -- @lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))' = true@ (?-|) :: (SqlDb db, LineLseg a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (?-|) = psqlOperatorCond "?-|" -- | Are parallel? --- +-- -- @lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))' = true@ (?||) :: (SqlDb db, LineLseg a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (?||) = psqlOperatorCond "?||" -- | Contains? --- +-- -- @circle '((0,0),2)' \@> point '(1,1)' = true@ (@>) :: (SqlDb db, Contains a b, ExpressionOf db r x a, ExpressionOf db r y b) => x -> y -> Cond db r (@>) = psqlOperatorCond "@>" -- | Contained in or on? --- +-- -- @point '(1,1)' <\@ circle '((0,0),2)' = true@ (<@) :: (SqlDb db, Contained a b, ExpressionOf db r x a, ExpressionOf db r y b) => x -> y -> Cond db r (<@) = psqlOperatorCond "<@" -- | Same as? --- +-- -- @polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))' = true@ (~=) :: (SqlDb db, BoxCirclePointPolygon a, ExpressionOf db r x a, ExpressionOf db r y a) => x -> y -> Cond db r (~=) = psqlOperatorCond "~="
Database/Groundhog/Postgresql/HStore.hs view
@@ -60,134 +60,134 @@ ---------------------------------------------------------------------- -psqlOperatorExpr :: (db ~ Postgresql, Expression db r a, Expression db r b) => String -> a -> b -> Expr db r c+psqlOperatorExpr :: (db ~ Postgresql, Expression db r a, Expression db r b, PersistField c) => String -> a -> b -> Expr db r c psqlOperatorExpr op x y = mkExpr $ operator 50 op x y psqlOperatorCond :: (db ~ Postgresql, Expression db r a, Expression db r b) => String -> a -> b -> Cond db r psqlOperatorCond op x y = CondRaw $ operator 50 op x y -- | Get value for key (NULL if not present)--- +-- -- @'a=>x, b=>y'::hstore -> 'a' == x@ (->.) :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r key key', IsString key') => hstore -> key -> Expr db r (Maybe Text) (->.) = psqlOperatorExpr "->" -- | Get values for keys array (NULL if not present)--- +-- -- @'a=>x, b=>y, c=>z'::hstore == ARRAY['c','a'] {"z","x"}@ lookupArr :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r keys (Array Text)) => hstore -> keys -> Expr db r (Array Text) lookupArr = psqlOperatorExpr "->" -- | Concatenate hstores--- +-- -- @'a=>b, c=>d'::hstore || 'c=>x, d=>q'::hstore == "a"=>"b", "c"=>"x", "d"=>"q"@ hstoreConcat :: (db ~ Postgresql, ExpressionOf db r hstore1 HStore, ExpressionOf db r hstore2 HStore) => hstore1 -> hstore2 -> Expr db r HStore hstoreConcat = psqlOperatorExpr "||" -- | Does hstore contain key? Same as postgresql operator ?.--- +-- -- @'a=>1'::hstore ? 'a' == True@ exist :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r key key', IsString key') => hstore -> key -> Cond db r exist h k = CondRaw $ function "exist" [toExpr h, toExpr k] -- | Does hstore contain non-NULL value for key?--- +-- -- @defined('a=>NULL','a') == f@ defined :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r key key', IsString key') => hstore -> key -> Cond db r defined h k = CondRaw $ function "defined" [toExpr h, toExpr k] -- | Does hstore contain all specified keys?--- +-- -- @'a=>1,b=>2'::hstore ?& ARRAY['a','b'] == True@ (?&) :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r keys (Array Text)) => hstore -> keys -> Cond db r (?&) = psqlOperatorCond "?&" -- | Does hstore contain any of the specified keys?--- +-- -- @'a=>1,b=>2'::hstore ?| ARRAY['b','c'] == True@ (?|) :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r keys (Array Text)) => hstore -> keys -> Cond db r (?|) = psqlOperatorCond "?|" -- | Does left operand contain right?--- +-- -- @'a=>b, b=>1, c=>NULL'::hstore @> 'b=>1' == True@ (@>) :: (db ~ Postgresql, ExpressionOf db r hstore1 HStore, ExpressionOf db r hstore2 HStore) => hstore1 -> hstore2 -> Cond db r (@>) = psqlOperatorCond "@>" -- | Is left operand contained in right?--- +-- -- @'a=>c'::hstore <@ 'a=>b, b=>1, c=>NULL' == False@ (<@) :: (db ~ Postgresql, ExpressionOf db r hstore1 HStore, ExpressionOf db r hstore2 HStore) => hstore1 -> hstore2 -> Cond db r (<@) = psqlOperatorCond "<@" -- | Delete key from left operand--- +-- -- @'a=>1, b=>2, c=>3'::hstore - 'b'::text == "a"=>"1", "c"=>"3"@ deleteKey :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r key key', IsString key') => hstore -> key -> Expr db r HStore deleteKey h k = mkExpr $ function "delete" [toExpr h, toExpr k] -- | Delete keys from left operand--- +-- -- @'a=>1, b=>2, c=>3'::hstore - ARRAY['a','b'] == "c"=>"3"@ deleteKeys :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r keys (Array Text)) => hstore -> keys -> Expr db r HStore deleteKeys h k = mkExpr $ function "delete" [toExpr h, toExpr k] -- | Delete matching pairs from left operand--- +-- -- @'a=>1, b=>2, c=>3'::hstore - 'a=>4, b=>2'::hstore == "a"=>"1", "c"=>"3"@ difference :: (db ~ Postgresql, ExpressionOf db r hstore1 HStore, ExpressionOf db r hstore2 HStore) => hstore1 -> hstore2 -> Expr db r HStore difference h1 h2 = mkExpr $ function "delete" [toExpr h1, toExpr h2] -- | Convert hstore to array of alternating keys and values. Same as prefix operator %%.--- +-- -- @hstore_to_array('a=>1,b=>2') == {a,1,b,2}@ hstore_to_array :: (db ~ Postgresql, ExpressionOf db r hstore HStore) => hstore -> Expr db r (Array Text) hstore_to_array h = mkExpr $ function "hstore_to_array" [toExpr h] -- | Convert hstore to two-dimensional key/value array. Same as prefix operator %#.--- +-- -- @hstore_to_matrix('a=>1,b=>2') == {{a,1},{b,2}}@ hstore_to_matrix :: (db ~ Postgresql, ExpressionOf db r hstore HStore) => hstore -> Expr db r (Array (Array Text)) hstore_to_matrix h = mkExpr $ function "hstore_to_matrix" [toExpr h] -- | Get hstore's keys as an array--- +-- -- @akeys('a=>1,b=>2') == {a,b}@ akeys :: (db ~ Postgresql, ExpressionOf db r hstore HStore) => hstore -> Expr db r (Array Text) akeys h = mkExpr $ function "akeys" [toExpr h] -- | Get hstore's values as an array--- +-- -- @avals('a=>1,b=>2') == {1,2}@ avals :: (db ~ Postgresql, ExpressionOf db r hstore HStore) => hstore -> Expr db r (Array Text) avals h = mkExpr $ function "vals" [toExpr h] -- | Get hstore as a json value--- --- @hstore_to_json('"a key"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>2.345e+4') +--+-- @hstore_to_json('"a key"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>2.345e+4') -- == {"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}@ hstore_to_json :: (db ~ Postgresql, ExpressionOf db r hstore HStore) => hstore -> Expr db r Value hstore_to_json h = mkExpr $ function "hstore_to_json" [toExpr h] -- | Get hstore as a json value, but attempting to distinguish numerical and Boolean values so they are unquoted in the JSON--- +-- -- @hstore_to_json_loose('"a key"=>1, b=>t, c=>null, d=>12345, e=>012345, f=>1.234, g=>2.345e+4') -- == {"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}@ hstore_to_json_loose :: (db ~ Postgresql, ExpressionOf db r hstore HStore)@@ -195,7 +195,7 @@ hstore_to_json_loose h = mkExpr $ function "hstore_to_json_loose" [toExpr h] -- | Extract a subset of an hstore--- +-- -- @slice('a=>1,b=>2,c=>3'::hstore, ARRAY['b','c','x']) =="b"=>"2", "c"=>"3"@ slice :: (db ~ Postgresql, ExpressionOf db r hstore HStore, ExpressionOf db r keys (Array Text)) => hstore -> keys -> Expr db r HStore
changelog view
@@ -1,3 +1,7 @@+0.10+* Pass type information along the UntypedExpr+* Fix #57 (table indexes are ignored)+ 0.9.0.1 * Bump upper bound for postgresql-simple
groundhog-postgresql.cabal view
@@ -1,5 +1,5 @@ name: groundhog-postgresql-version: 0.9.0.1+version: 0.10 license: BSD3 license-file: LICENSE author: Boris Lykah <lykahb@gmail.com>@@ -22,7 +22,7 @@ , bytestring >= 0.9 , blaze-builder >= 0.3 && < 0.5 , transformers >= 0.2.1 && < 0.6- , groundhog >= 0.9.0 && < 0.10+ , groundhog >= 0.10 && < 0.11 , monad-control >= 0.3 && < 1.1 , containers >= 0.2 , text >= 0.8