| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hasql.Interpolate.Internal.TH
Synopsis
- sql :: QuasiQuoter
- addParam :: State Int Builder
- parseSqlExpr :: String -> Either (ParseErrorBundle String Void) SqlExpr
- compileSqlExpr :: SqlExpr -> Q Exp
- data SqlExpr = SqlExpr {
- sqlBuilderExp :: [SqlBuilderExp]
- paramEncoder :: [ParamEncoder]
- spliceBinds :: [SpliceBind]
- bindCount :: Int
- data SqlBuilderExp
- = Sbe'Var Int
- | Sbe'Param
- | Sbe'Quote String
- | Sbe'Ident String
- | Sbe'DollarQuote String String
- | Sbe'Cquote String
- | Sbe'Sql String
- data ParamEncoder
- data SpliceBind = SpliceBind {
- sbBuilder :: Int
- sbParamEncoder :: Int
- sbExp :: Exp
Documentation
QuasiQuoter that supports interpolation and splices. Produces a
Sql.
#{..} interpolates a haskell expression into a sql query.
example1 :: EncodeValue a => a -> Sql
example1 x = [sql| select #{x} |]
^{..} introduces a splice, which allows us to inject a sql
snippet along with the associated parameters into another sql
snippet.
example2 :: Sql
example2 = [sql| ^{example1 True} where true |]
parseSqlExpr :: String -> Either (ParseErrorBundle String Void) SqlExpr Source #
compileSqlExpr :: SqlExpr -> Q Exp Source #
Constructors
| SqlExpr | |
Fields
| |
Instances
data SqlBuilderExp Source #
Constructors
| Sbe'Var Int | |
| Sbe'Param | |
| Sbe'Quote String | |
| Sbe'Ident String | |
| Sbe'DollarQuote String String | |
| Sbe'Cquote String | |
| Sbe'Sql String |
Instances
| Show SqlBuilderExp Source # | |
Defined in Hasql.Interpolate.Internal.TH Methods showsPrec :: Int -> SqlBuilderExp -> ShowS show :: SqlBuilderExp -> String showList :: [SqlBuilderExp] -> ShowS | |
| Eq SqlBuilderExp Source # | |
Defined in Hasql.Interpolate.Internal.TH | |
data ParamEncoder Source #
Instances
| Show ParamEncoder Source # | |
Defined in Hasql.Interpolate.Internal.TH Methods showsPrec :: Int -> ParamEncoder -> ShowS show :: ParamEncoder -> String showList :: [ParamEncoder] -> ShowS | |
| Eq ParamEncoder Source # | |
Defined in Hasql.Interpolate.Internal.TH | |
data SpliceBind Source #
Constructors
| SpliceBind | |
Fields
| |
Instances
| Show SpliceBind Source # | |
Defined in Hasql.Interpolate.Internal.TH Methods showsPrec :: Int -> SpliceBind -> ShowS show :: SpliceBind -> String showList :: [SpliceBind] -> ShowS | |
| Eq SpliceBind Source # | |
Defined in Hasql.Interpolate.Internal.TH | |