module Database.Persist.Query
( PersistQuery (..)
, selectList
, selectKeysList
, deleteCascadeWhere
, SelectOpt (..)
, Filter (..)
, (=.), (+=.), (-=.), (*=.), (/=.)
, (==.), (!=.), (<.), (>.), (<=.), (>=.)
, (<-.), (/<-.)
, (||.)
) where
import Database.Persist.Store
import Database.Persist.Query.Internal
import Database.Persist.Query.GenericSql ()
infixr 3 =., +=., -=., *=., /=.
(=.), (+=.), (-=.), (*=.), (/=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
f =. a = Update f a Assign
f +=. a = Update f a Add
f -=. a = Update f a Subtract
f *=. a = Update f a Multiply
f /=. a = Update f a Divide
infix 4 ==., <., <=., >., >=., !=.
(==.), (!=.), (<.), (<=.), (>.), (>=.) ::
forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
f ==. a = Filter f (Left a) Eq
f !=. a = Filter f (Left a) Ne
f <. a = Filter f (Left a) Lt
f <=. a = Filter f (Left a) Le
f >. a = Filter f (Left a) Gt
f >=. a = Filter f (Left a) Ge
infix 4 <-., /<-.
(<-.), (/<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v
f <-. a = Filter f (Right a) In
f /<-. a = Filter f (Right a) NotIn
infixl 3 ||.
(||.) :: forall v. [Filter v] -> [Filter v] -> [Filter v]
a ||. b = [FilterOr [FilterAnd a, FilterAnd b]]