squeal-postgresql-0.5.2.0: Squeal PostgreSQL Library

Copyright(c) Eitan Chatav 2019
Maintainereitan@morphism.tech
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Squeal.PostgreSQL.Expression.Parameter

Description

Parameters, out-of-line data values

Synopsis

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 params are used to refer to the out-of-line data values.

Minimal complete definition

Nothing

Methods

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 # 
Instance details

Defined in Squeal.PostgreSQL.Expression.Parameter

Methods

parameter :: TypeExpression schemas ty -> Expression outer commons grp schemas (ty' ': params) from ty Source #

HasParameter 1 (ty1 ': tys) ty1 Source # 
Instance details

Defined in Squeal.PostgreSQL.Expression.Parameter

Methods

parameter :: TypeExpression schemas ty1 -> Expression outer commons grp schemas (ty1 ': tys) from ty1 Source #

param Source #

Arguments

:: (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)