Safe Haskell | None |
---|
This module defines the functions which are used only for backends creation.
- renderCond :: forall r db. (SqlDb db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> (Utf8 -> Utf8 -> Utf8) -> (Utf8 -> Utf8 -> Utf8) -> Cond db r -> Maybe (RenderS db r)
- defaultShowPrim :: PersistValue -> String
- renderOrders :: forall db r. (Utf8 -> Utf8) -> [Order db r] -> Utf8
- renderUpdates :: (SqlDb db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> [Update db r] -> Maybe (RenderS db r)
- renderFields :: (Utf8 -> Utf8) -> [(String, DbType)] -> Utf8
- renderChain :: (Utf8 -> Utf8) -> FieldChain -> [Utf8] -> [Utf8]
- renderExpr :: (DbDescriptor db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> UntypedExpr db r -> RenderS db r
- renderExprPriority :: (DbDescriptor db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> Int -> UntypedExpr db r -> RenderS db r
- renderExprExtended :: (DbDescriptor db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> Int -> UntypedExpr db r -> [RenderS db r]
- renderPersistValue :: PersistValue -> RenderS db r
- intercalateS :: StringLike s => s -> [s] -> s
- commasJoin :: StringLike s => [s] -> s
- flatten :: (Utf8 -> Utf8) -> (String, DbType) -> [Utf8] -> [Utf8]
- data RenderS db r = RenderS {
- getQuery :: Utf8
- getValues :: [PersistValue] -> [PersistValue]
- newtype Utf8 = Utf8 Builder
- fromUtf8 :: Utf8 -> ByteString
- class (Monoid a, IsString a) => StringLike a where
- fromString :: IsString a => String -> a
- (<>) :: Monoid m => m -> m -> m
- function :: (SqlDb db, QueryRaw db ~ Snippet db) => String -> [UntypedExpr db r] -> Snippet db r
- operator :: (SqlDb db, QueryRaw db ~ Snippet db, Expression db r a, Expression db r b) => Int -> String -> a -> b -> Snippet db r
- parens :: Int -> Int -> RenderS db r -> RenderS db r
- newtype Snippet db r = Snippet ((Utf8 -> Utf8) -> Int -> [RenderS db r])
- class DbDescriptor db => SqlDb db where
- append :: (ExpressionOf db r a String, ExpressionOf db r b String) => a -> b -> Expr db r String
- liftExpr :: (SqlDb db, QueryRaw db ~ Snippet db, ExpressionOf db r a b) => a -> Expr db r b
- tableName :: StringLike s => (s -> s) -> EntityDef -> ConstructorDef -> s
- mainTableName :: StringLike s => (s -> s) -> EntityDef -> s
SQL rendering utilities
:: forall r db . (SqlDb db, QueryRaw db ~ Snippet db) | |
=> (Utf8 -> Utf8) | escape |
-> (Utf8 -> Utf8 -> Utf8) | render equals |
-> (Utf8 -> Utf8 -> Utf8) | render not equals |
-> Cond db r | |
-> Maybe (RenderS db r) |
Renders conditions for SQL backend. Returns Nothing if the fields don't have any columns.
renderUpdates :: (SqlDb db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> [Update db r] -> Maybe (RenderS db r)Source
renderChain :: (Utf8 -> Utf8) -> FieldChain -> [Utf8] -> [Utf8]Source
renderExpr :: (DbDescriptor db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> UntypedExpr db r -> RenderS db rSource
renderExprPriority :: (DbDescriptor db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> Int -> UntypedExpr db r -> RenderS db rSource
renderExprExtended :: (DbDescriptor db, QueryRaw db ~ Snippet db) => (Utf8 -> Utf8) -> Int -> UntypedExpr db r -> [RenderS db r]Source
renderPersistValue :: PersistValue -> RenderS db rSource
intercalateS :: StringLike s => s -> [s] -> sSource
commasJoin :: StringLike s => [s] -> sSource
RenderS | |
|
Datatype for incremental building SQL queries
fromUtf8 :: Utf8 -> ByteStringSource
class (Monoid a, IsString a) => StringLike a whereSource
StringLike String | |
StringLike Utf8 | |
StringLike (RenderS db r) |
fromString :: IsString a => String -> a
function :: (SqlDb db, QueryRaw db ~ Snippet db) => String -> [UntypedExpr db r] -> Snippet db rSource
operator :: (SqlDb db, QueryRaw db ~ Snippet db, Expression db r a, Expression db r b) => Int -> String -> a -> b -> Snippet db rSource
Escape function, priority of the outer operator. The result is a list for the embedded data which may expand to several RenderS.
class DbDescriptor db => SqlDb db whereSource
This class distinguishes databases which support SQL-specific expressions. It contains ad hoc members for features whose syntax differs across the databases.
append :: (ExpressionOf db r a String, ExpressionOf db r b String) => a -> b -> Expr db r StringSource
tableName :: StringLike s => (s -> s) -> EntityDef -> ConstructorDef -> sSource
Returns escaped table name optionally qualified with schema
mainTableName :: StringLike s => (s -> s) -> EntityDef -> sSource
Returns escaped main table name optionally qualified with schema