-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Interpolated SQL queries via quasiquotation -- -- Interpolated SQL queries via quasiquotation @package postgresql-simple-interpolate @version 0.1 -- | Parsers for antiquoted Haskell expressions inside strings. -- -- This module was largely copied from -- https://github.com/tmhedberg/here/blob/8a616b358bcc16bd215a78a8f6192ad9df8224b6/src/Data/String/Here/Interpolated.hs module Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser data StringPart Lit :: String -> StringPart Esc :: Char -> StringPart Anti :: Q Exp -> StringPart data HsChompState HsChompState :: QuoteState -> Int -> String -> Bool -> HsChompState [quoteState] :: HsChompState -> QuoteState [braceCt] :: HsChompState -> Int [consumed] :: HsChompState -> String [prevCharWasIdentChar] :: HsChompState -> Bool data QuoteState None :: QuoteState Single :: EscapeState -> QuoteState Double :: EscapeState -> QuoteState data EscapeState Escaped :: EscapeState Unescaped :: EscapeState parseInterpolated :: String -> Either ParseError [StringPart] pInterp :: Parser [StringPart] pStringPart :: Parser StringPart pAnti :: Parser StringPart pAntiOpen :: Parser String pAntiClose :: Parser String pAntiExpr :: Parser (Q Exp) pUntilUnbalancedCloseBrace :: Parser String pEsc :: Parser StringPart pLit :: Parser StringPart instance GHC.Show.Show Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.QuoteState instance GHC.Classes.Ord Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.QuoteState instance GHC.Classes.Eq Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.QuoteState instance GHC.Show.Show Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.EscapeState instance GHC.Classes.Ord Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.EscapeState instance GHC.Classes.Eq Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.EscapeState instance GHC.Enum.Enum Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.EscapeState instance GHC.Enum.Bounded Database.PostgreSQL.Simple.SqlQQ.Interpolated.Parser.EscapeState -- | Interpolated SQL queries module Database.PostgreSQL.Simple.SqlQQ.Interpolated -- | Quote a SQL statement with embedded antiquoted expressions. -- -- The result of the quasiquoter is a tuple, containing the statement -- string and a list of parameters. For example: -- --
--   [isql|SELECT field FROM table WHERE name = ${map toLower ELLIOT} LIMIT ${10}|]
--   
-- -- produces -- --
--   ("SELECT field FROM table WHERE name = ? LIMIT ?", [Escape "elliot", Plain "10"])
--   
-- -- How the parser works: -- -- Any expression occurring between ${ and } will be -- replaced with a ? and passed as a query parameter. -- -- Characters preceded by a backslash are treated literally. This enables -- the inclusion of the literal substring ${ within your quoted -- text by writing it as \${. The literal sequence \${ -- may be written as \\${. -- -- Note: This quasiquoter is a wrapper around sql which also -- "minifies" the query at compile time by stripping whitespace and -- comments. However, there are a few "gotchas" to be aware of so please -- refer to the documentation of that function for a full specification. -- -- This quasiquoter only works in expression contexts and will throw an -- error at compile time if used in any other context. isql :: QuasiQuoter -- | The internal parser used by isql. quoteInterpolatedSql :: String -> Q Exp