Safe Haskell | None |
---|
Database.Groundhog.Generic.PersistBackendHelpers
Description
This helper module contains generic versions of PersistBackend functions
Documentation
get :: forall m v. (PersistBackend m, PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> Key v BackendSpecific -> m (Maybe v)Source
select :: forall m db r v c opts. (db ~ PhantomDb m, r ~ RestrictionHolder v c, PersistBackend m, PersistEntity v, EntityConstr v c, HasSelectOptions opts db r) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> Utf8 -> (Cond db r -> Maybe (RenderS db r)) -> opts -> m [v]Source
selectAll :: forall m v. (PersistBackend m, PersistEntity v) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> m [(AutoKey v, v)]Source
Arguments
:: forall m v u . (PersistBackend m, PersistEntity v, IsUniqueKey (Key v (Unique u))) | |
=> (Utf8 -> Utf8) | escape |
-> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) | function to run query |
-> Utf8 | condition to compare with constant |
-> Key v (Unique u) | |
-> m (Maybe v) |
project :: forall m db r v c p opts a'. (SqlDb db, QueryRaw db ~ Snippet db, db ~ PhantomDb m, r ~ RestrictionHolder v c, PersistBackend m, PersistEntity v, EntityConstr v c, Projection p db r a', HasSelectOptions opts db r) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> Utf8 -> (Cond db r -> Maybe (RenderS db r)) -> p -> opts -> m [a']Source
count :: forall m db r v c. (db ~ PhantomDb m, r ~ RestrictionHolder v c, PersistBackend m, PersistEntity v, EntityConstr v c) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> (Cond db r -> Maybe (RenderS db r)) -> Cond db r -> m IntSource
replace :: forall m db r v. (PersistBackend m, PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> (Utf8 -> [PersistValue] -> m ()) -> (Bool -> Utf8 -> ConstructorDef -> [PersistValue] -> RenderS db r) -> Key v BackendSpecific -> v -> m ()Source
update :: forall m db r v c. (SqlDb db, QueryRaw db ~ Snippet db, db ~ PhantomDb m, r ~ RestrictionHolder v c, PersistBackend m, PersistEntity v, EntityConstr v c) => (Utf8 -> Utf8) -> (Utf8 -> [PersistValue] -> m ()) -> (Cond db r -> Maybe (RenderS db r)) -> [Update db r] -> Cond db r -> m ()Source
delete :: forall m db r v c. (db ~ PhantomDb m, r ~ RestrictionHolder v c, PersistBackend m, PersistEntity v, EntityConstr v c) => (Utf8 -> Utf8) -> (Utf8 -> [PersistValue] -> m ()) -> (Cond db r -> Maybe (RenderS db r)) -> Cond db r -> m ()Source
Arguments
:: forall m v . (PersistBackend m, PersistEntity v) | |
=> (Utf8 -> Utf8) | escape |
-> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) | function to run query |
-> Utf8 | condition to compare with constant |
-> v | |
-> m (Either (AutoKey v) (AutoKey v)) |
deleteByKey :: forall m v. (PersistBackend m, PersistEntity v, PrimitivePersistField (Key v BackendSpecific)) => (Utf8 -> Utf8) -> (Utf8 -> [PersistValue] -> m ()) -> Key v BackendSpecific -> m ()Source
countAll :: forall m v. (PersistBackend m, PersistEntity v) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> v -> m IntSource
insertBy :: forall m v u. (PersistBackend m, PersistEntity v, IsUniqueKey (Key v (Unique u))) => (Utf8 -> Utf8) -> (forall a. Utf8 -> [DbType] -> [PersistValue] -> (RowPopper m -> m a) -> m a) -> Utf8 -> u (UniqueMarker v) -> v -> m (Either (AutoKey v) (AutoKey v))Source