| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Sql.Query
Description
Internal to the arbiter packages. Not covered by the PVP.
A SQL query bundling its text, its positional parameters, and its row
decoder in one value. The text is a list of literals and parameter holes, rendered
in the placeholder form each backend needs. Built by the sql
quasiquoter in Arbiter.Core.Sql.QQ. The parameters and decoder use the
same Col-driven vocabulary as the profunctor codec in
Arbiter.Core.Codec.
Synopsis
- data Query a = Query {}
- mkQuery :: [Piece] -> Params -> RowCodec a -> Query a
- raw :: Text -> Query ()
- param :: SomeParam -> Query ()
- rows :: RowCodec a -> Query () -> Query a
- rawRows :: RowCodec a -> Text -> Query a
- sepBy :: Text -> [Query ()] -> Query ()
- mwhen :: Monoid m => Bool -> m -> m
- data Piece
- class ToFragment a where
- toFragment :: a -> Query ()
Documentation
A parameterized query paired with the decoder for its result rows.
Constructors
| Query | |
Instances
mkQuery :: [Piece] -> Params -> RowCodec a -> Query aSource #
A query from its pieces, parameters and decoder.
rows :: RowCodec a -> Query () -> Query aSource #
Attach a handwritten row decoder to a parameterized fragment.
rawRows :: RowCodec a -> Text -> Query aSource #
Attach a decoder to literal, parameter-free SQL rendered as plain Text.
sepBy :: Text -> [Query ()] -> Query ()Source #
Join fragments with a separator, concatenating their text and parameters in order.
mwhen :: Monoid m => Bool -> m -> mSource #
The fragment under a true flag. mempty under a false one.
One run of literal SQL or one parameter hole.
class ToFragment a whereSource #
Values a ${...} splice accepts: raw Text (a bare clause or table name)
or a Query fragment (whose parameters interleave at the splice site).
Instances
| ToFragment Text Source # | |
Defined in Arbiter.Core.Sql.Query Methods toFragment :: Text -> Query ()Source # | |
| ToFragment (Query ()) Source # | |
Defined in Arbiter.Core.Sql.Query Methods toFragment :: Query () -> Query ()Source # | |