squeal-postgresql-0.6.0.1: Squeal PostgreSQL Library

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

Squeal.PostgreSQL.Expression.Parameter

Contents

Description

out-of-line parameters

Synopsis

Parameter

class KnownNat n => HasParameter (n :: Nat) (params :: [NullType]) (ty :: NullType) | 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 db ty -> Expression grp lat with db params from ty Source #

parameter takes a Nat using type application and a TypeExpression.

>>> let expr = parameter @1 int4 :: Expression lat '[] grp db '[ '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 db ty -> Expression grp lat with db (ty' ': params) from ty Source #

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

Defined in Squeal.PostgreSQL.Expression.Parameter

Methods

parameter :: TypeExpression db ty1 -> Expression grp lat with db (ty1 ': tys) from ty1 Source #

param Source #

Arguments

:: (NullTyped db ty, HasParameter n params ty) 
=> Expression grp lat with db params from ty

param

param takes a Nat using type application and for basic types, infers a TypeExpression.

>>> let expr = param @1 :: Expression grp lat with db '[ 'Null 'PGint4] from ('Null 'PGint4)
>>> printSQL expr
($1 :: int4)