Safe Haskell | None |
---|
This module provides mechanism for flexible and typesafe usage of plain data values and fields. The expressions can used in conditions and right part of Update statement. Example:
StringField ==. "abc" &&. NumberField >. (0 :: Int) ||. MaybeField ==. (Nothing :: Maybe String) ||. MaybeField ==. Just "def"
Note that polymorphic values like numbers or Nothing must have a type annotation
- class Expression db r a where
- toExpr :: a -> UntypedExpr db r
- class Unifiable a b
- class (Expression db r a, Unifiable a a') => ExpressionOf db r a a'
- (=.) :: (FieldLike f db r a', Expression db r b, Unifiable f b) => f -> b -> Update db r
- (&&.) :: Cond db r -> Cond db r -> Cond db r
- (||.) :: Cond db r -> Cond db r -> Cond db r
- (==.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
- (/=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
- (<.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
- (<=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
- (>.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
- (>=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db r
Documentation
class Expression db r a whereSource
Instances of this type can be converted to UntypedExpr
. It is useful for uniform manipulation over fields, constant values, etc.
toExpr :: a -> UntypedExpr db rSource
PurePersistField a => Expression db r a | |
(PersistEntity v, IsUniqueKey k, ~ * k (Key v (Unique u)), ~ * (RestrictionHolder v c) r') => Expression db r' (u (UniqueMarker v)) | |
(EntityConstr v c, ~ * (RestrictionHolder v c) r') => Expression db r' (AutoKeyField v c) | |
(EntityConstr v c, PersistField a, ~ * (RestrictionHolder v c) r') => Expression db r' (SubField v c a) | |
(EntityConstr v c, PersistField a, ~ * (RestrictionHolder v c) r') => Expression db r' (Field v c a) | |
(PersistField a, ~ * db' db, ~ * r' r) => Expression db' r' (Expr db r a) |
class (Expression db r a, Unifiable a a') => ExpressionOf db r a a' Source
This helper class can make type signatures more concise
(Expression db r a, Unifiable a a') => ExpressionOf db r a a' |
(=.) :: (FieldLike f db r a', Expression db r b, Unifiable f b) => f -> b -> Update db rSource
Update field
(==.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db rSource
(/=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db rSource
(<.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db rSource
(<=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db rSource
(>.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db rSource
(>=.) :: (Expression db r a, Expression db r b, Unifiable a b) => a -> b -> Cond db rSource