- class PersistStore b m => PersistQuery b m where
- update :: PersistEntity val => Key b val -> [Update val] -> b m ()
- updateWhere :: PersistEntity val => [Filter val] -> [Update val] -> b m ()
- deleteWhere :: PersistEntity val => [Filter val] -> b m ()
- selectSource :: PersistEntity val => [Filter val] -> [SelectOpt val] -> Source (b m) (Entity b val)
- selectFirst :: PersistEntity val => [Filter val] -> [SelectOpt val] -> b m (Maybe (Entity b val))
- selectKeys :: PersistEntity val => [Filter val] -> Source (b m) (Key b val)
- count :: PersistEntity val => [Filter val] -> b m Int
- selectList :: (PersistEntity val, PersistQuery b m) => [Filter val] -> [SelectOpt val] -> b m [Entity b val]
- deleteCascadeWhere :: (DeleteCascade a b m, PersistQuery b m) => [Filter a] -> b m ()
- data SelectOpt v
- = forall typ . Asc (EntityField v typ)
- | forall typ . Desc (EntityField v typ)
- | OffsetBy Int
- | LimitTo Int
- data Filter v
- = forall typ . PersistField typ => Filter {
- filterField :: EntityField v typ
- filterValue :: Either typ [typ]
- filterFilter :: PersistFilter
- | FilterAnd [Filter v]
- | FilterOr [Filter v]
- = forall typ . PersistField typ => Filter {
- (=.), (/=.), (*=.), (-=.), (+=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
- (==.), (>=.), (>.), (<=.), (<.), (!=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
- (<-.), (/<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v
- (||.) :: forall v. [Filter v] -> [Filter v] -> [Filter v]
Documentation
class PersistStore b m => PersistQuery b m whereSource
update :: PersistEntity val => Key b val -> [Update val] -> b m ()Source
Update individual fields on a specific record.
updateWhere :: PersistEntity val => [Filter val] -> [Update val] -> b m ()Source
Update individual fields on any record matching the given criterion.
deleteWhere :: PersistEntity val => [Filter val] -> b m ()Source
Delete all records matching the given criterion.
selectSource :: PersistEntity val => [Filter val] -> [SelectOpt val] -> Source (b m) (Entity b val)Source
Get all records matching the given criterion in the specified order. Returns also the identifiers.
selectFirst :: PersistEntity val => [Filter val] -> [SelectOpt val] -> b m (Maybe (Entity b val))Source
get just the first record for the criterion
selectKeys :: PersistEntity val => [Filter val] -> Source (b m) (Key b val)Source
Get the Key
s of all records matching the given criterion.
count :: PersistEntity val => [Filter val] -> b m IntSource
The total number of records fulfilling the given criterion.
ResourceIO m => PersistQuery SqlPersist m |
selectList :: (PersistEntity val, PersistQuery b m) => [Filter val] -> [SelectOpt val] -> b m [Entity b val]Source
Call select
but return the result as a list.
deleteCascadeWhere :: (DeleteCascade a b m, PersistQuery b m) => [Filter a] -> b m ()Source
forall typ . Asc (EntityField v typ) | |
forall typ . Desc (EntityField v typ) | |
OffsetBy Int | |
LimitTo Int |
Filters which are available for select
, updateWhere
and
deleteWhere
. Each filter constructor specifies the field being
filtered on, the type of comparison applied (equals, not equals, etc)
and the argument for the comparison.
forall typ . PersistField typ => Filter | |
| |
FilterAnd [Filter v] | convenient for internal use, not needed for the API |
FilterOr [Filter v] |
query combinators
(=.), (/=.), (*=.), (-=.), (+=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update vSource
(==.), (>=.), (>.), (<=.), (<.), (!=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter vSource
assign a field a value
assign a field by addition (+=)
assign a field by subtraction (-=)
assign a field by multiplication (*=)
assign a field by division (/=)
(<-.), (/<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter vSource