| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Sql.QQ
Description
The sql quasiquoter. It builds a Query whose text, parameters, and row
decoder all come from one template.
Holes reference in-scope identifiers, like NeatInterpolation's ${var}:
${x}splices a fragment:Text(raw clause or table name) or aQuery ()(its parameters interleave at the splice site), viaToFragment.#{ident :: CInt8}emits one?and binds in-scopeidentas a parameter.Maybe CInt8,[CInt8], and[Maybe CInt8]pick the nullable, array, and nullable-array encoders.@{name :: CInt8}emits the identifiernameand addscol "name" CInt8to the decoder (Maybe CInt8usesncol). The quote's result type isQueryof the tuple of these holes, orQuery ()when there are none.
A bare ? is rejected. Every placeholder comes from a hole. Use jsonb_exists
and friends for jsonb key-existence.
Synopsis
- sql :: QuasiQuoter
Documentation
The sql quasiquoter, valid in expression position.