Safe Haskell | None |
---|---|
Language | Haskell2010 |
Parser and prettyprinter for native query code.
Synopsis
- data InterpolatedItem variable
- = IIText Text
- | IIVariable variable
- newtype InterpolatedQuery variable = InterpolatedQuery {
- getInterpolatedQuery :: [InterpolatedItem variable]
- parseInterpolatedQuery :: Text -> Either Text (InterpolatedQuery ArgumentName)
- getUniqueVariables :: Ord var => InterpolatedQuery var -> Set var
- trimQueryEnd :: InterpolatedQuery var -> InterpolatedQuery var
Documentation
data InterpolatedItem variable Source #
A component of an interpolated query
IIText Text | normal text |
IIVariable variable | a captured variable |
Instances
newtype InterpolatedQuery variable Source #
A list of stored procedure components representing a single stored procedure, separating the variables from the text.
InterpolatedQuery | |
|
Instances
parseInterpolatedQuery :: Text -> Either Text (InterpolatedQuery ArgumentName) Source #
extract all of the `{{ variable }}` inside our query string
getUniqueVariables :: Ord var => InterpolatedQuery var -> Set var Source #
Get a set of all arguments used in an interpolated query.
trimQueryEnd :: InterpolatedQuery var -> InterpolatedQuery var Source #
Remove spaces and semicolon from the end of a query and add a newline, for sql backends.