Add some documentaion to SqlExpr.
This commit is contained in:
parent
e8013a93d4
commit
53402d726f
@ -232,16 +232,35 @@ type Insertion = Proxy
|
|||||||
|
|
||||||
-- | An expression on the SQL backend.
|
-- | An expression on the SQL backend.
|
||||||
data SqlExpr a where
|
data SqlExpr a where
|
||||||
EInsert :: Proxy a -> (Connection -> (TLB.Builder, [PersistValue])) -> SqlExpr (Insertion a)
|
-- | An entity, created by 'from' (cf. 'fromStart').
|
||||||
EEntity :: Ident -> SqlExpr (Entity val)
|
EEntity :: Ident -> SqlExpr (Entity val)
|
||||||
|
|
||||||
|
-- | Just a tag stating that something is nullable.
|
||||||
EMaybe :: SqlExpr a -> SqlExpr (Maybe a)
|
EMaybe :: SqlExpr a -> SqlExpr (Maybe a)
|
||||||
|
|
||||||
|
-- | Raw expression: states whether parenthesis are needed
|
||||||
|
-- around this expression, and takes information about the SQL
|
||||||
|
-- connection (mainly for escaping names) and returns both an
|
||||||
|
-- string ('TLB.Builder') and a list of values to be
|
||||||
|
-- interpolated by the SQL backend.
|
||||||
ERaw :: NeedParens -> (Connection -> (TLB.Builder, [PersistValue])) -> SqlExpr (Value a)
|
ERaw :: NeedParens -> (Connection -> (TLB.Builder, [PersistValue])) -> SqlExpr (Value a)
|
||||||
EList :: SqlExpr (Value a) -> SqlExpr (ValueList a)
|
|
||||||
|
-- | 'EList' and 'EEmptyList' are used by list operators.
|
||||||
|
EList :: SqlExpr (Value a) -> SqlExpr (ValueList a)
|
||||||
EEmptyList :: SqlExpr (ValueList a)
|
EEmptyList :: SqlExpr (ValueList a)
|
||||||
|
|
||||||
|
-- | A 'SqlExpr' accepted only by 'orderBy'.
|
||||||
EOrderBy :: OrderByType -> SqlExpr (Value a) -> SqlExpr OrderBy
|
EOrderBy :: OrderByType -> SqlExpr (Value a) -> SqlExpr OrderBy
|
||||||
ESet :: (SqlExpr (Entity val) -> SqlExpr (Value ())) -> SqlExpr (Update val)
|
|
||||||
|
-- | A 'SqlExpr' accepted only by 'set'.
|
||||||
|
ESet :: (SqlExpr (Entity val) -> SqlExpr (Value ())) -> SqlExpr (Update val)
|
||||||
|
|
||||||
|
-- | An internal 'SqlExpr' used by the 'from' hack.
|
||||||
EPreprocessedFrom :: a -> FromClause -> SqlExpr (PreprocessedFrom a)
|
EPreprocessedFrom :: a -> FromClause -> SqlExpr (PreprocessedFrom a)
|
||||||
|
|
||||||
|
-- | Used by 'insertSelect'.
|
||||||
|
EInsert :: Proxy a -> (Connection -> (TLB.Builder, [PersistValue])) -> SqlExpr (Insertion a)
|
||||||
|
|
||||||
data NeedParens = Parens | Never
|
data NeedParens = Parens | Never
|
||||||
|
|
||||||
parensM :: NeedParens -> TLB.Builder -> TLB.Builder
|
parensM :: NeedParens -> TLB.Builder -> TLB.Builder
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user