Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Parameters, out-of-line data values
Synopsis
- class KnownNat n => HasParameter (n :: Nat) (params :: [NullityType]) (ty :: NullityType) | n params -> ty where
- parameter :: TypeExpression schemas ty -> Expression outer commons grp schemas params from ty
- param :: forall n outer commons schemas params from grp ty. (PGTyped schemas ty, HasParameter n params ty) => Expression outer commons grp schemas params from ty
Documentation
class KnownNat n => HasParameter (n :: Nat) (params :: [NullityType]) (ty :: NullityType) | n params -> ty where Source #
A HasParameter
constraint is used to indicate a value that is
supplied externally to a SQL statement.
manipulateParams
,
queryParams
and
traversePrepared
support specifying data values
separately from the SQL command string, in which case param
s are used to
refer to the out-of-line data values.
Nothing
parameter :: TypeExpression schemas ty -> Expression outer commons grp schemas params from ty Source #
parameter
takes a Nat
using type application and a TypeExpression
.
>>>
let expr = parameter @1 int4 :: Expression outer '[] grp schemas '[ 'Null 'PGint4] from ('Null 'PGint4)
>>>
printSQL expr
($1 :: int4)
Instances
(KnownNat n, HasParameter (n - 1) params ty) => HasParameter n (ty' ': params) ty Source # | |
Defined in Squeal.PostgreSQL.Expression.Parameter parameter :: TypeExpression schemas ty -> Expression outer commons grp schemas (ty' ': params) from ty Source # | |
HasParameter 1 (ty1 ': tys) ty1 Source # | |
Defined in Squeal.PostgreSQL.Expression.Parameter parameter :: TypeExpression schemas ty1 -> Expression outer commons grp schemas (ty1 ': tys) from ty1 Source # |
:: (PGTyped schemas ty, HasParameter n params ty) | |
=> Expression outer commons grp schemas params from ty | param |
param
takes a Nat
using type application and for basic types,
infers a TypeExpression
.
>>>
let expr = param @1 :: Expression outer commons grp schemas '[ 'Null 'PGint4] from ('Null 'PGint4)
>>>
printSQL expr
($1 :: int4)