Safe Haskell | None |
---|
- class PersistStore m => PersistQuery m where
- update :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => Key val -> [Update val] -> m ()
- updateGet :: (PersistEntity val, PersistMonadBackend m ~ PersistEntityBackend val) => Key val -> [Update val] -> m val
- updateWhere :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [Update val] -> m ()
- deleteWhere :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> m ()
- selectSource :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [SelectOpt val] -> Source m (Entity val)
- selectFirst :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [SelectOpt val] -> m (Maybe (Entity val))
- selectKeys :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [SelectOpt val] -> Source m (Key val)
- count :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> m Int
- newtype SqlPersist m a = SqlPersist {
- unSqlPersist :: ReaderT Connection m a
- filterClauseNoWhere :: PersistEntity val => Bool -> Connection -> [Filter val] -> Text
- filterClauseNoWhereOrNull :: PersistEntity val => Bool -> Connection -> [Filter val] -> Text
- getFiltsValues :: forall val. PersistEntity val => Connection -> [Filter val] -> [PersistValue]
- selectSourceConn :: (PersistEntity val, MonadResource m, MonadLogger m, PersistEntityBackend val ~ SqlBackend, MonadBaseControl IO m) => Connection -> [Filter val] -> [SelectOpt val] -> Source m (Entity val)
- dummyFromFilts :: [Filter v] -> v
- orderClause :: PersistEntity val => Bool -> Connection -> SelectOpt val -> Text
Documentation
class PersistStore m => PersistQuery m whereSource
update :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => Key val -> [Update val] -> m ()Source
Update individual fields on a specific record.
updateGet :: (PersistEntity val, PersistMonadBackend m ~ PersistEntityBackend val) => Key val -> [Update val] -> m valSource
Update individual fields on a specific record, and retrieve the updated value from the database.
Note that this function will throw an exception if the given key is not found in the database.
updateWhere :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [Update val] -> m ()Source
Update individual fields on any record matching the given criterion.
deleteWhere :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> m ()Source
Delete all records matching the given criterion.
selectSource :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [SelectOpt val] -> Source m (Entity val)Source
Get all records matching the given criterion in the specified order. Returns also the identifiers.
selectFirst :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [SelectOpt val] -> m (Maybe (Entity val))Source
get just the first record for the criterion
selectKeys :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> [SelectOpt val] -> Source m (Key val)Source
Get the Key
s of all records matching the given criterion.
count :: (PersistEntity val, PersistEntityBackend val ~ PersistMonadBackend m) => [Filter val] -> m IntSource
The total number of records fulfilling the given criterion.
newtype SqlPersist m a Source
SqlPersist | |
|
:: PersistEntity val | |
=> Bool | include table name? |
-> Connection | |
-> [Filter val] | |
-> Text |
filterClauseNoWhereOrNullSource
:: PersistEntity val | |
=> Bool | include table name? |
-> Connection | |
-> [Filter val] | |
-> Text |
getFiltsValues :: forall val. PersistEntity val => Connection -> [Filter val] -> [PersistValue]Source
selectSourceConn :: (PersistEntity val, MonadResource m, MonadLogger m, PersistEntityBackend val ~ SqlBackend, MonadBaseControl IO m) => Connection -> [Filter val] -> [SelectOpt val] -> Source m (Entity val)Source
Equivalent to selectSource
, but instead of getting the connection from
the environment inside a SqlPersist
monad, provide an explicit
Connection
. This can allow you to use the returned Source
in an
arbitrary monad.
dummyFromFilts :: [Filter v] -> vSource
:: PersistEntity val | |
=> Bool | include the table name |
-> Connection | |
-> SelectOpt val | |
-> Text |