packages feed

groundhog 0.3.0 → 0.3.0.1

raw patch · 3 files changed

+25/−16 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Database.Groundhog: (&&.) :: Cond db r -> Cond db r -> Cond db r
+ Database.Groundhog: (/=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
+ Database.Groundhog: (<.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
+ Database.Groundhog: (<=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
+ Database.Groundhog: (=.) :: (FieldLike f db r a', Expression db r b, Unifiable f b) => f -> b -> Update db r
+ Database.Groundhog: (==.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
+ Database.Groundhog: (>.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
+ Database.Groundhog: (>=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
+ Database.Groundhog: (||.) :: Cond db r -> Cond db r -> Cond db r
+ Database.Groundhog: (~>) :: (PersistEntity v, Constructor c, FieldLike f db (RestrictionHolder v c) a, Embedded a) => f -> Selector a a' -> SubField v c a'
+ Database.Groundhog: And :: (Cond db r) -> (Cond db r) -> Cond db r
+ Database.Groundhog: Asc :: f -> Order db r
+ Database.Groundhog: AutoKeyField :: AutoKeyField v c
+ Database.Groundhog: Compare :: ExprRelation -> (UntypedExpr db r) -> (UntypedExpr db r) -> Cond db r
+ Database.Groundhog: CondRaw :: (QueryRaw db r) -> Cond db r
+ Database.Groundhog: DbPersist :: ReaderT conn m a -> DbPersist conn m a
+ Database.Groundhog: Desc :: f -> Order db r
+ Database.Groundhog: Not :: (Cond db r) -> Cond db r
+ Database.Groundhog: Or :: (Cond db r) -> (Cond db r) -> Cond db r
+ Database.Groundhog: class (Monad m, DbDescriptor (PhantomDb m)) => PersistBackend m where type family PhantomDb m
+ Database.Groundhog: count :: (PersistBackend m, PersistEntity v, Constructor c) => Cond (PhantomDb m) (RestrictionHolder v c) -> m Int
+ Database.Groundhog: countAll :: (PersistBackend m, PersistEntity v) => v -> m Int
+ Database.Groundhog: createMigration :: PersistBackend m => Migration m -> m NamedMigrations
+ Database.Groundhog: data AutoKeyField v c
+ Database.Groundhog: data BackendSpecific
+ Database.Groundhog: data Cond db r
+ Database.Groundhog: data Order db r
+ Database.Groundhog: data Unique (u :: (* -> *) -> *)
+ Database.Groundhog: defaultMigrationLogger :: String -> IO ()
+ Database.Groundhog: delete :: (PersistBackend m, PersistEntity v, Constructor c) => Cond (PhantomDb m) (RestrictionHolder v c) -> m ()
+ Database.Groundhog: deleteByKey :: (PersistBackend m, PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => Key v BackendSpecific -> m ()
+ Database.Groundhog: executeMigration :: (PersistBackend m, MonadIO m) => (String -> IO ()) -> NamedMigrations -> m ()
+ Database.Groundhog: executeMigrationUnsafe :: (PersistBackend m, MonadIO m) => (String -> IO ()) -> NamedMigrations -> m ()
+ Database.Groundhog: executeRaw :: PersistBackend m => Bool -> String -> [PersistValue] -> m ()
+ Database.Groundhog: extractUnique :: (IsUniqueKey uKey, uKey ~ Key v u) => v -> uKey
+ Database.Groundhog: get :: (PersistBackend m, PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => Key v BackendSpecific -> m (Maybe v)
+ Database.Groundhog: getBy :: (PersistBackend m, PersistEntity v, IsUniqueKey (Key v (Unique u))) => Key v (Unique u) -> m (Maybe v)
+ Database.Groundhog: getList :: (PersistBackend m, PersistField a) => Int64 -> m [a]
+ Database.Groundhog: insert :: (PersistBackend m, PersistEntity v) => v -> m (AutoKey v)
+ Database.Groundhog: insertBy :: (PersistBackend m, PersistEntity v, IsUniqueKey (Key v (Unique u))) => u (UniqueMarker v) -> v -> m (Either (AutoKey v) (AutoKey v))
+ Database.Groundhog: insertByAll :: (PersistBackend m, PersistEntity v) => v -> m (Either (AutoKey v) (AutoKey v))
+ Database.Groundhog: insertList :: (PersistBackend m, PersistField a) => [a] -> m Int64
+ Database.Groundhog: insert_ :: (PersistBackend m, PersistEntity v) => v -> m ()
+ Database.Groundhog: limitTo :: (HasSelectOptions a db r, HasLimit a ~ HFalse) => a -> Int -> SelectOptions db r HTrue (HasOffset a) (HasOrder a)
+ Database.Groundhog: migrate :: (PersistBackend m, PersistEntity v) => v -> Migration m
+ Database.Groundhog: newtype Monad m => DbPersist conn m a
+ Database.Groundhog: offsetBy :: (HasSelectOptions a db r, HasOffset a ~ HFalse) => a -> Int -> SelectOptions db r (HasLimit a) HTrue (HasOrder a)
+ Database.Groundhog: orderBy :: (HasSelectOptions a db r, HasOrder a ~ HFalse) => a -> [Order db r] -> SelectOptions db r (HasLimit a) (HasOffset a) HTrue
+ Database.Groundhog: printMigration :: MonadIO m => NamedMigrations -> m ()
+ Database.Groundhog: project :: (PersistBackend m, PersistEntity v, Constructor c, Projection p (PhantomDb m) (RestrictionHolder v c) a', HasSelectOptions opts (PhantomDb m) (RestrictionHolder v c)) => p -> opts -> m [a']
+ Database.Groundhog: queryRaw :: PersistBackend m => Bool -> String -> [PersistValue] -> (RowPopper m -> m a) -> m a
+ Database.Groundhog: replace :: (PersistBackend m, PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => Key v BackendSpecific -> v -> m ()
+ Database.Groundhog: runMigration :: (PersistBackend m, MonadIO m) => (String -> IO ()) -> Migration m -> m ()
+ Database.Groundhog: runMigrationUnsafe :: (PersistBackend m, MonadIO m) => (String -> IO ()) -> Migration m -> m ()
+ Database.Groundhog: select :: (PersistBackend m, PersistEntity v, Constructor c, HasSelectOptions opts (PhantomDb m) (RestrictionHolder v c)) => opts -> m [v]
+ Database.Groundhog: selectAll :: (PersistBackend m, PersistEntity v) => m [(AutoKey v, v)]
+ Database.Groundhog: silentMigrationLogger :: String -> IO ()
+ Database.Groundhog: unDbPersist :: DbPersist conn m a -> ReaderT conn m a
+ Database.Groundhog: update :: (PersistBackend m, PersistEntity v, Constructor c) => [Update (PhantomDb m) (RestrictionHolder v c)] -> Cond (PhantomDb m) (RestrictionHolder v c) -> m ()

Files

Database/Groundhog.hs view
@@ -40,12 +40,11 @@ --  melon <- select $ (ProductNameField ==. \"Melon\") \`orderBy\` ['Desc' QuantityField] --  liftIO $ putStrLn $ \"Melon orders: \" ++ show melon -- @-module Database.Groundhog (module G) where--import Database.Groundhog.Core as G-  ( PersistBackend(..)+module Database.Groundhog (+  -- * Main definitions+    PersistBackend(..)   , DbPersist(..)-  , Key(..)+  , Key   , Unique   , BackendSpecific   , extractUnique@@ -56,16 +55,23 @@   , (~>)   , limitTo   , offsetBy-  , orderBy)-import Database.Groundhog.Expression as G-import Database.Groundhog.Generic as G-  ( createMigration+  , orderBy+  -- * Expressions+  , (=.)+  , (&&.), (||.)+  , (==.), (/=.), (<.), (<=.), (>.), (>=.)+  -- * Migration+  , createMigration   , executeMigration   , executeMigrationUnsafe   , runMigration   , runMigrationUnsafe   , printMigration   , silentMigrationLogger-  , defaultMigrationLogger)+  , defaultMigrationLogger+) where -import Database.Groundhog.Instances as G+import Database.Groundhog.Core+import Database.Groundhog.Expression+import Database.Groundhog.Generic+import Database.Groundhog.Instances
Database/Groundhog/Core.hs view
@@ -192,6 +192,7 @@   , orderOptions  :: [Order db r]   } +-- | This class helps to check that limit, offset, or order clauses are added to condition only once. class HasSelectOptions a db r | a -> db r where   type HasLimit a   type HasOffset a@@ -250,7 +251,7 @@   backendName :: Proxy db -> String  class (Monad m, DbDescriptor (PhantomDb m)) => PersistBackend m where-  -- | A token which defines the DB type. For example, different monads working with Sqlite, return Sqlite type.+  -- | A token which defines the DB type. For example, different monads working with Sqlite, return may Sqlite type.   type PhantomDb m   -- | Insert a new record to a database and return its autogenerated key or ()   insert        :: PersistEntity v => v -> m (AutoKey v)@@ -264,7 +265,7 @@   insertByAll   :: PersistEntity v => v -> m (Either (AutoKey v) (AutoKey v))   -- | Replace a record with the given autogenerated key. Result is undefined if the record does not exist.   replace       :: (PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => Key v BackendSpecific -> v -> m ()-  -- | Return a list of the records satisfying the condition+  -- | Return a list of the records satisfying the condition. Example: @select $ (FirstField ==. \"abc\" &&. SecondField >. \"def\") \`orderBy\` [Asc ThirdField] \`limitBy\` 100@   select        :: (PersistEntity v, Constructor c, HasSelectOptions opts (PhantomDb m) (RestrictionHolder v c))                 => opts -> m [v]   -- | Return a list of all records. Order is undefined. It is useful for datatypes with multiple constructors.@@ -273,7 +274,7 @@   get           :: (PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => Key v BackendSpecific -> m (Maybe v)   -- | Fetch an entity from a database by its unique key   getBy         :: (PersistEntity v, IsUniqueKey (Key v (Unique u))) => Key v (Unique u) -> m (Maybe v)-  -- | Update the records satisfying the condition+  -- | Update the records satisfying the condition. Example: @update [FirstField =. \"abc\"] $ FirstField ==. \"def\"@   update        :: (PersistEntity v, Constructor c) => [Update (PhantomDb m) (RestrictionHolder v c)] -> Cond (PhantomDb m) (RestrictionHolder v c) -> m ()   -- | Remove the records satisfying the condition   delete        :: (PersistEntity v, Constructor c) => Cond (PhantomDb m) (RestrictionHolder v c) -> m ()@@ -283,7 +284,7 @@   count         :: (PersistEntity v, Constructor c) => Cond (PhantomDb m) (RestrictionHolder v c) -> m Int   -- | Count total number of records with all constructors   countAll      :: PersistEntity v => v -> m Int-  -- | Fetch projection of some fields+  -- | Fetch projection of some fields. Example: @project (SecondField, ThirdField) $ (FirstField ==. \"abc\" &&. SecondField >. \"def\") \`orderBy\` [Asc ThirdField] \`offsetBy\` 100@   project       :: (PersistEntity v, Constructor c, Projection p (PhantomDb m) (RestrictionHolder v c) a', HasSelectOptions opts (PhantomDb m) (RestrictionHolder v c))                 => p                 -> opts@@ -351,7 +352,9 @@  class (Constructor (UniqueConstr uKey), PurePersistField uKey) => IsUniqueKey uKey where   type UniqueConstr uKey :: (* -> *) -> *+  -- | Creates value of unique key using the data extracted from the passed value   extractUnique :: uKey ~ Key v u => v -> uKey+  -- | Ordinal number of the unique constraint in the list returned by 'constrUniques'   uniqueNum :: uKey -> Int  -- | Unique name and list of the field names that form a unique combination
groundhog.cabal view
@@ -1,5 +1,5 @@ name:            groundhog-version:         0.3.0+version:         0.3.0.1 license:         BSD3 license-file:    LICENSE author:          Boris Lykah <lykahb@gmail.com>