Copyright | (c) Eitan Chatav 2017 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Squeal expressions are the atoms used to build statements.
Synopsis
- newtype Expression (schema :: SchemaType) (relations :: RelationsType) (grouping :: Grouping) (params :: [NullityType]) (ty :: NullityType) = UnsafeExpression {}
- class KnownNat n => HasParameter (n :: Nat) (schema :: SchemaType) (params :: [NullityType]) (ty :: NullityType) | n params -> ty where
- param :: forall n schema params relations grouping ty. (PGTyped schema (PGTypeOf ty), HasParameter n schema params ty) => Expression schema relations grouping params ty
- null_ :: Expression schema rels grouping params (Null ty)
- notNull :: Expression schema rels grouping params (NotNull ty) -> Expression schema rels grouping params (Null ty)
- coalesce :: [Expression schema relations grouping params (Null ty)] -> Expression schema relations grouping params (NotNull ty) -> Expression schema relations grouping params (NotNull ty)
- fromNull :: Expression schema relations grouping params (NotNull ty) -> Expression schema relations grouping params (Null ty) -> Expression schema relations grouping params (NotNull ty)
- isNull :: Expression schema relations grouping params (Null ty) -> Condition schema relations grouping params
- isNotNull :: Expression schema relations grouping params (Null ty) -> Condition schema relations grouping params
- matchNull :: Expression schema relations grouping params nullty -> (Expression schema relations grouping params (NotNull ty) -> Expression schema relations grouping params nullty) -> Expression schema relations grouping params (Null ty) -> Expression schema relations grouping params nullty
- nullIf :: Expression schema relations grouping params (NotNull ty) -> Expression schema relations grouping params (NotNull ty) -> Expression schema relations grouping params (Null ty)
- array :: [Expression schema relations grouping params (Null ty)] -> Expression schema relations grouping params (nullity (PGvararray ty))
- row :: SListI (Nulls fields) => NP (Aliased (Expression schema relations grouping params)) (Nulls fields) -> Expression schema relations grouping params (nullity (PGcomposite fields))
- unsafeBinaryOp :: ByteString -> Expression schema relations grouping params ty0 -> Expression schema relations grouping params ty1 -> Expression schema relations grouping params ty2
- unsafeUnaryOp :: ByteString -> Expression schema relations grouping params ty0 -> Expression schema relations grouping params ty1
- unsafeFunction :: ByteString -> Expression schema relations grouping params xty -> Expression schema relations grouping params yty
- atan2_ :: PGFloating float => Expression schema relations grouping params (nullity float) -> Expression schema relations grouping params (nullity float) -> Expression schema relations grouping params (nullity float)
- cast :: TypeExpression schema ty1 -> Expression schema relations grouping params (nullity ty0) -> Expression schema relations grouping params (nullity ty1)
- quot_ :: PGIntegral int => Expression schema relations grouping params (nullity int) -> Expression schema relations grouping params (nullity int) -> Expression schema relations grouping params (nullity int)
- rem_ :: PGIntegral int => Expression schema relations grouping params (nullity int) -> Expression schema relations grouping params (nullity int) -> Expression schema relations grouping params (nullity int)
- trunc :: PGFloating frac => Expression schema relations grouping params (nullity frac) -> Expression schema relations grouping params (nullity frac)
- round_ :: PGFloating frac => Expression schema relations grouping params (nullity frac) -> Expression schema relations grouping params (nullity frac)
- ceiling_ :: PGFloating frac => Expression schema relations grouping params (nullity frac) -> Expression schema relations grouping params (nullity frac)
- greatest :: Expression schema relations grouping params nullty -> [Expression schema relations grouping params nullty] -> Expression schema relations grouping params nullty
- least :: Expression schema relations grouping params nullty -> [Expression schema relations grouping params nullty] -> Expression schema relations grouping params nullty
- type Condition schema relations grouping params = Expression schema relations grouping params (NotNull PGbool)
- true :: Condition schema relations grouping params
- false :: Condition schema relations grouping params
- not_ :: Condition schema relations grouping params -> Condition schema relations grouping params
- (.&&) :: Condition schema relations grouping params -> Condition schema relations grouping params -> Condition schema relations grouping params
- (.||) :: Condition schema relations grouping params -> Condition schema relations grouping params -> Condition schema relations grouping params
- caseWhenThenElse :: [(Condition schema relations grouping params, Expression schema relations grouping params ty)] -> Expression schema relations grouping params ty -> Expression schema relations grouping params ty
- ifThenElse :: Condition schema relations grouping params -> Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Expression schema relations grouping params ty
- (.==) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity PGbool)
- (./=) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity PGbool)
- (.>=) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity PGbool)
- (.<) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity PGbool)
- (.<=) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity PGbool)
- (.>) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity PGbool)
- currentDate :: Expression schema relations grouping params (nullity PGdate)
- currentTime :: Expression schema relations grouping params (nullity PGtimetz)
- currentTimestamp :: Expression schema relations grouping params (nullity PGtimestamptz)
- localTime :: Expression schema relations grouping params (nullity PGtime)
- localTimestamp :: Expression schema relations grouping params (nullity PGtimestamp)
- lower :: Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext)
- upper :: Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext)
- charLength :: Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGint4)
- like :: Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGbool)
- unsafeAggregate :: ByteString -> Expression schema relations Ungrouped params xty -> Expression schema relations (Grouped bys) params yty
- unsafeAggregateDistinct :: ByteString -> Expression schema relations Ungrouped params xty -> Expression schema relations (Grouped bys) params yty
- sum_ :: PGNum ty => Expression schema relations Ungrouped params (nullity ty) -> Expression schema relations (Grouped bys) params (nullity ty)
- sumDistinct :: PGNum ty => Expression schema relations Ungrouped params (nullity ty) -> Expression schema relations (Grouped bys) params (nullity ty)
- class PGAvg ty avg | ty -> avg where
- bitAnd :: PGIntegral int => Expression schema relations Ungrouped params (nullity int) -> Expression schema relations (Grouped bys) params (nullity int)
- bitOr :: PGIntegral int => Expression schema relations Ungrouped params (nullity int) -> Expression schema relations (Grouped bys) params (nullity int)
- boolAnd :: Expression schema relations Ungrouped params (nullity PGbool) -> Expression schema relations (Grouped bys) params (nullity PGbool)
- boolOr :: Expression schema relations Ungrouped params (nullity PGbool) -> Expression schema relations (Grouped bys) params (nullity PGbool)
- bitAndDistinct :: PGIntegral int => Expression schema relations Ungrouped params (nullity int) -> Expression schema relations (Grouped bys) params (nullity int)
- bitOrDistinct :: PGIntegral int => Expression schema relations Ungrouped params (nullity int) -> Expression schema relations (Grouped bys) params (nullity int)
- boolAndDistinct :: Expression schema relations Ungrouped params (nullity PGbool) -> Expression schema relations (Grouped bys) params (nullity PGbool)
- boolOrDistinct :: Expression schema relations Ungrouped params (nullity PGbool) -> Expression schema relations (Grouped bys) params (nullity PGbool)
- countStar :: Expression schema relations (Grouped bys) params (NotNull PGint8)
- count :: Expression schema relations Ungrouped params ty -> Expression schema relations (Grouped bys) params (NotNull PGint8)
- countDistinct :: Expression schema relations Ungrouped params ty -> Expression schema relations (Grouped bys) params (NotNull PGint8)
- every :: Expression schema relations Ungrouped params (nullity PGbool) -> Expression schema relations (Grouped bys) params (nullity PGbool)
- everyDistinct :: Expression schema relations Ungrouped params (nullity PGbool) -> Expression schema relations (Grouped bys) params (nullity PGbool)
- max_ :: Expression schema relations Ungrouped params (nullity ty) -> Expression schema relations (Grouped bys) params (nullity ty)
- maxDistinct :: Expression schema relations Ungrouped params (nullity ty) -> Expression schema relations (Grouped bys) params (nullity ty)
- min_ :: Expression schema relations Ungrouped params (nullity ty) -> Expression schema relations (Grouped bys) params (nullity ty)
- minDistinct :: Expression schema relations Ungrouped params (nullity ty) -> Expression schema relations (Grouped bys) params (nullity ty)
- newtype TypeExpression (schema :: SchemaType) (ty :: PGType) = UnsafeTypeExpression {}
- class PGTyped schema (ty :: PGType) where
- bool :: TypeExpression schema PGbool
- int2 :: TypeExpression schema PGint2
- smallint :: TypeExpression schema PGint2
- int4 :: TypeExpression schema PGint4
- int :: TypeExpression schema PGint4
- integer :: TypeExpression schema PGint4
- int8 :: TypeExpression schema PGint8
- bigint :: TypeExpression schema PGint8
- numeric :: TypeExpression schema PGnumeric
- float4 :: TypeExpression schema PGfloat4
- real :: TypeExpression schema PGfloat4
- float8 :: TypeExpression schema PGfloat8
- doublePrecision :: TypeExpression schema PGfloat8
- text :: TypeExpression schema PGtext
- char :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGchar n)
- character :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGchar n)
- varchar :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGvarchar n)
- characterVarying :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGvarchar n)
- bytea :: TypeExpression schema PGbytea
- timestamp :: TypeExpression schema PGtimestamp
- timestampWithTimeZone :: TypeExpression schema PGtimestamptz
- date :: TypeExpression schema PGdate
- time :: TypeExpression schema PGtime
- timeWithTimeZone :: TypeExpression schema PGtimetz
- interval :: TypeExpression schema PGinterval
- uuid :: TypeExpression schema PGuuid
- inet :: TypeExpression schema PGinet
- json :: TypeExpression schema PGjson
- jsonb :: TypeExpression schema PGjsonb
- vararray :: TypeExpression schema pg -> TypeExpression schema (PGvararray pg)
- fixarray :: KnownNat n => proxy n -> TypeExpression schema pg -> TypeExpression schema (PGfixarray n pg)
- (&) :: a -> (a -> b) -> b
- data NP (a :: k -> *) (b :: [k]) :: forall k. (k -> *) -> [k] -> * where
Expression
newtype Expression (schema :: SchemaType) (relations :: RelationsType) (grouping :: Grouping) (params :: [NullityType]) (ty :: NullityType) Source #
Expression
s are used in a variety of contexts,
such as in the target list of the select
command,
as new column values in insertRow
or
update
,
or in search Condition
s in a number of commands.
The expression syntax allows the calculation of values from primitive expression using arithmetic, logical, and other operations.
Instances
(Has relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsQualified relation column (NP (Aliased (Expression schema relations (Grouped bys) params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) Source # | |
(Has relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsQualified relation column (Aliased (Expression schema relations (Grouped bys) params) (column ::: ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has relation relations columns, Has column columns ty) => IsQualified relation column (NP (Aliased (Expression schema relations Ungrouped params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) Source # | |
(Has relation relations columns, Has column columns ty) => IsQualified relation column (Aliased (Expression schema relations Ungrouped params) (column ::: ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsQualified relation column (Expression schema relations (Grouped bys) params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has relation relations columns, Has column columns ty) => IsQualified relation column (Expression schema relations Ungrouped params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
Has field fields ty => IsLabel field (Expression schema relation grouping params (nullity (PGcomposite fields)) -> Expression schema relation grouping params (Null ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: Expression schema relation grouping params (nullity (PGcomposite fields)) -> Expression schema relation grouping params (Null ty) # | |
(HasUnique relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsLabel column (NP (Aliased (Expression schema relations (Grouped bys) params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsLabel column (Aliased (Expression schema relations (Grouped bys) params) (column ::: ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique relation relations columns, Has column columns ty) => IsLabel column (NP (Aliased (Expression schema relations Ungrouped params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique relation relations columns, Has column columns ty) => IsLabel column (Aliased (Expression schema relations Ungrouped params) (column ::: ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsLabel column (Expression schema relations (Grouped bys) params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: Expression schema relations (Grouped bys) params ty # | |
(HasUnique relation relations columns, Has column columns ty) => IsLabel column (Expression schema relations Ungrouped params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: Expression schema relations Ungrouped params ty # | |
(KnownSymbol label, In label labels) => IsPGlabel label (Expression schema relations grouping params (nullity (PGenum labels))) Source # | |
Defined in Squeal.PostgreSQL.Expression label :: Expression schema relations grouping params (nullity (PGenum labels)) Source # | |
Eq (Expression schema relations grouping params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression (==) :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Bool # (/=) :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Bool # | |
(PGNum ty, PGFloating ty) => Floating (Expression schema relations grouping params (nullity ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression pi :: Expression schema relations grouping params (nullity ty) # exp :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # log :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # sqrt :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # (**) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # logBase :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # sin :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # cos :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # tan :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # asin :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # acos :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # atan :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # sinh :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # cosh :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # tanh :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # asinh :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # acosh :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # atanh :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # log1p :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # expm1 :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # log1pexp :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # log1mexp :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # | |
(PGNum ty, PGFloating ty) => Fractional (Expression schema relations grouping params (nullity ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression (/) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # recip :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # fromRational :: Rational -> Expression schema relations grouping params (nullity ty) # | |
PGNum ty => Num (Expression schema relations grouping params (nullity ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression (+) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # (-) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # (*) :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # negate :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # abs :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # signum :: Expression schema relations grouping params (nullity ty) -> Expression schema relations grouping params (nullity ty) # fromInteger :: Integer -> Expression schema relations grouping params (nullity ty) # | |
Ord (Expression schema relations grouping params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression compare :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Ordering # (<) :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Bool # (<=) :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Bool # (>) :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Bool # (>=) :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Bool # max :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Expression schema relations grouping params ty # min :: Expression schema relations grouping params ty -> Expression schema relations grouping params ty -> Expression schema relations grouping params ty # | |
Show (Expression schema relations grouping params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression showsPrec :: Int -> Expression schema relations grouping params ty -> ShowS # show :: Expression schema relations grouping params ty -> String # showList :: [Expression schema relations grouping params ty] -> ShowS # | |
IsString (Expression schema relations grouping params (nullity PGtext)) Source # | |
Defined in Squeal.PostgreSQL.Expression fromString :: String -> Expression schema relations grouping params (nullity PGtext) # | |
Generic (Expression schema relations grouping params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression type Rep (Expression schema relations grouping params ty) :: * -> * # from :: Expression schema relations grouping params ty -> Rep (Expression schema relations grouping params ty) x # to :: Rep (Expression schema relations grouping params ty) x -> Expression schema relations grouping params ty # | |
Semigroup (Expression schema relations grouping params (nullity PGtext)) Source # | |
Defined in Squeal.PostgreSQL.Expression (<>) :: Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext) # sconcat :: NonEmpty (Expression schema relations grouping params (nullity PGtext)) -> Expression schema relations grouping params (nullity PGtext) # stimes :: Integral b => b -> Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext) # | |
Semigroup (Expression schema relations grouping params (nullity (PGvararray ty))) Source # | |
Defined in Squeal.PostgreSQL.Expression (<>) :: Expression schema relations grouping params (nullity (PGvararray ty)) -> Expression schema relations grouping params (nullity (PGvararray ty)) -> Expression schema relations grouping params (nullity (PGvararray ty)) # sconcat :: NonEmpty (Expression schema relations grouping params (nullity (PGvararray ty))) -> Expression schema relations grouping params (nullity (PGvararray ty)) # stimes :: Integral b => b -> Expression schema relations grouping params (nullity (PGvararray ty)) -> Expression schema relations grouping params (nullity (PGvararray ty)) # | |
Monoid (Expression schema relations grouping params (nullity PGtext)) Source # | |
Defined in Squeal.PostgreSQL.Expression mempty :: Expression schema relations grouping params (nullity PGtext) # mappend :: Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext) -> Expression schema relations grouping params (nullity PGtext) # mconcat :: [Expression schema relations grouping params (nullity PGtext)] -> Expression schema relations grouping params (nullity PGtext) # | |
Monoid (Expression schema relations grouping params (nullity (PGvararray ty))) Source # | |
Defined in Squeal.PostgreSQL.Expression mempty :: Expression schema relations grouping params (nullity (PGvararray ty)) # mappend :: Expression schema relations grouping params (nullity (PGvararray ty)) -> Expression schema relations grouping params (nullity (PGvararray ty)) -> Expression schema relations grouping params (nullity (PGvararray ty)) # mconcat :: [Expression schema relations grouping params (nullity (PGvararray ty))] -> Expression schema relations grouping params (nullity (PGvararray ty)) # | |
NFData (Expression schema relations grouping params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression rnf :: Expression schema relations grouping params ty -> () # | |
RenderSQL (Expression schema relations grouping params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression renderSQL :: Expression schema relations grouping params ty -> ByteString Source # | |
type Rep (Expression schema relations grouping params ty) Source # | |
Defined in Squeal.PostgreSQL.Expression type Rep (Expression schema relations grouping params ty) = D1 (MetaData "Expression" "Squeal.PostgreSQL.Expression" "squeal-postgresql-0.3.1.0-DNDeh0HTANH3vXYqblRMwD" True) (C1 (MetaCons "UnsafeExpression" PrefixI True) (S1 (MetaSel (Just "renderExpression") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString))) |
class KnownNat n => HasParameter (n :: Nat) (schema :: SchemaType) (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.
parameter :: TypeExpression schema (PGTypeOf ty) -> Expression schema relations grouping params ty Source #
parameter
takes a Nat
using type application and a TypeExpression
.
>>>
let expr = parameter @1 int4 :: Expression sch rels grp '[ 'Null 'PGint4] ('Null 'PGint4)
>>>
printSQL expr
($1 :: int4)
Instances
(KnownNat n, HasParameter (n - 1) schema params ty) => HasParameter n schema (ty' ': params) ty Source # | |
Defined in Squeal.PostgreSQL.Expression parameter :: TypeExpression schema (PGTypeOf ty) -> Expression schema relations grouping (ty' ': params) ty Source # | |
HasParameter 1 schema (ty1 ': tys) ty1 Source # | |
Defined in Squeal.PostgreSQL.Expression parameter :: TypeExpression schema (PGTypeOf ty1) -> Expression schema relations grouping (ty1 ': tys) ty1 Source # |
:: (PGTyped schema (PGTypeOf ty), HasParameter n schema params ty) | |
=> Expression schema relations grouping params ty | param |
param
takes a Nat
using type application and for basic types,
infers a TypeExpression
.
>>>
let expr = param @1 :: Expression sch rels grp '[ 'Null 'PGint4] ('Null 'PGint4)
>>>
printSQL expr
($1 :: int4)
Null
null_ :: Expression schema rels grouping params (Null ty) Source #
analagous to Nothing
>>>
printSQL null_
NULL
notNull :: Expression schema rels grouping params (NotNull ty) -> Expression schema rels grouping params (Null ty) Source #
analagous to Just
>>>
printSQL $ notNull true
TRUE
:: [Expression schema relations grouping params (Null ty)] |
|
-> Expression schema relations grouping params (NotNull ty) |
|
-> Expression schema relations grouping params (NotNull ty) |
return the leftmost value which is not NULL
>>>
printSQL $ coalesce [null_, notNull true] false
COALESCE(NULL, TRUE, FALSE)
:: Expression schema relations grouping params (NotNull ty) | what to convert |
-> Expression schema relations grouping params (Null ty) | |
-> Expression schema relations grouping params (NotNull ty) |
analagous to fromMaybe
using COALESCE
>>>
printSQL $ fromNull true null_
COALESCE(NULL, TRUE)
:: Expression schema relations grouping params (Null ty) | possibly |
-> Condition schema relations grouping params |
>>>
printSQL $ null_ & isNull
NULL IS NULL
:: Expression schema relations grouping params (Null ty) | possibly |
-> Condition schema relations grouping params |
>>>
printSQL $ null_ & isNotNull
NULL IS NOT NULL
:: Expression schema relations grouping params nullty | what to convert |
-> (Expression schema relations grouping params (NotNull ty) -> Expression schema relations grouping params nullty) | function to perform when |
-> Expression schema relations grouping params (Null ty) | |
-> Expression schema relations grouping params nullty |
analagous to maybe
using IS NULL
>>>
printSQL $ matchNull true not_ null_
CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END
:: Expression schema relations grouping params (NotNull ty) |
|
-> Expression schema relations grouping params (NotNull ty) |
|
-> Expression schema relations grouping params (Null ty) |
Collections
:: [Expression schema relations grouping params (Null ty)] | array elements |
-> Expression schema relations grouping params (nullity (PGvararray ty)) |
>>>
printSQL $ array [null_, notNull false, notNull true]
ARRAY[NULL, FALSE, TRUE]
:: SListI (Nulls fields) | |
=> NP (Aliased (Expression schema relations grouping params)) (Nulls fields) | zero or more expressions for the row field values |
-> Expression schema relations grouping params (nullity (PGcomposite fields)) |
A row constructor is an expression that builds a row value (also called a composite value) using values for its member fields.
>>>
type Complex = PGcomposite '["real" ::: 'PGfloat8, "imaginary" ::: 'PGfloat8]
>>>
let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression '[] '[] 'Ungrouped '[] ('NotNull Complex)
>>>
printSQL i
ROW(0, 1)
Functions
:: ByteString | operator |
-> Expression schema relations grouping params ty0 | |
-> Expression schema relations grouping params ty1 | |
-> Expression schema relations grouping params ty2 |
>>>
printSQL $ unsafeBinaryOp "OR" true false
(TRUE OR FALSE)
:: ByteString | operator |
-> Expression schema relations grouping params ty0 | |
-> Expression schema relations grouping params ty1 |
>>>
printSQL $ unsafeUnaryOp "NOT" true
(NOT TRUE)
:: ByteString | function |
-> Expression schema relations grouping params xty | |
-> Expression schema relations grouping params yty |
>>>
printSQL $ unsafeFunction "f" true
f(TRUE)
:: PGFloating float | |
=> Expression schema relations grouping params (nullity float) | numerator |
-> Expression schema relations grouping params (nullity float) | denominator |
-> Expression schema relations grouping params (nullity float) |
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGfloat4) expression = atan2_ pi 2 in printSQL expression :} atan2(pi(), 2)
:: TypeExpression schema ty1 | type to cast as |
-> Expression schema relations grouping params (nullity ty0) | value to convert |
-> Expression schema relations grouping params (nullity ty1) |
>>>
printSQL $ true & cast int4
(TRUE :: int4)
:: PGIntegral int | |
=> Expression schema relations grouping params (nullity int) | numerator |
-> Expression schema relations grouping params (nullity int) | denominator |
-> Expression schema relations grouping params (nullity int) |
integer division, truncates the result
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGint2) expression = 5 `quot_` 2 in printSQL expression :} (5 / 2)
:: PGIntegral int | |
=> Expression schema relations grouping params (nullity int) | numerator |
-> Expression schema relations grouping params (nullity int) | denominator |
-> Expression schema relations grouping params (nullity int) |
remainder upon integer division
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGint2) expression = 5 `rem_` 2 in printSQL expression :} (5 % 2)
:: PGFloating frac | |
=> Expression schema relations grouping params (nullity frac) | fractional number |
-> Expression schema relations grouping params (nullity frac) |
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGfloat4) expression = trunc pi in printSQL expression :} trunc(pi())
:: PGFloating frac | |
=> Expression schema relations grouping params (nullity frac) | fractional number |
-> Expression schema relations grouping params (nullity frac) |
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGfloat4) expression = round_ pi in printSQL expression :} round(pi())
:: PGFloating frac | |
=> Expression schema relations grouping params (nullity frac) | fractional number |
-> Expression schema relations grouping params (nullity frac) |
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGfloat4) expression = ceiling_ pi in printSQL expression :} ceiling(pi())
:: Expression schema relations grouping params nullty | needs at least 1 argument |
-> [Expression schema relations grouping params nullty] | or more |
-> Expression schema relations grouping params nullty |
>>>
let expr = greatest currentTimestamp [param @1] :: Expression sch rels grp '[ 'NotNull 'PGtimestamptz] ('NotNull 'PGtimestamptz)
>>>
printSQL expr
GREATEST(CURRENT_TIMESTAMP, ($1 :: timestamp with time zone))
:: Expression schema relations grouping params nullty | needs at least 1 argument |
-> [Expression schema relations grouping params nullty] | or more |
-> Expression schema relations grouping params nullty |
>>>
printSQL $ least currentTimestamp [null_]
LEAST(CURRENT_TIMESTAMP, NULL)
Conditions
type Condition schema relations grouping params = Expression schema relations grouping params (NotNull PGbool) Source #
A Condition
is a boolean valued Expression
. While SQL allows
conditions to have NULL
, Squeal instead chooses to disallow NULL
,
forcing one to handle the case of NULL
explicitly to produce
a Condition
.
not_ :: Condition schema relations grouping params -> Condition schema relations grouping params Source #
>>>
printSQL $ not_ true
(NOT TRUE)
(.&&) :: Condition schema relations grouping params -> Condition schema relations grouping params -> Condition schema relations grouping params Source #
>>>
printSQL $ true .&& false
(TRUE AND FALSE)
(.||) :: Condition schema relations grouping params -> Condition schema relations grouping params -> Condition schema relations grouping params Source #
>>>
printSQL $ true .|| false
(TRUE OR FALSE)
:: [(Condition schema relations grouping params, Expression schema relations grouping params ty)] | whens and thens |
-> Expression schema relations grouping params ty | else |
-> Expression schema relations grouping params ty |
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGint2) expression = caseWhenThenElse [(true, 1), (false, 2)] 3 in printSQL expression :} CASE WHEN TRUE THEN 1 WHEN FALSE THEN 2 ELSE 3 END
:: Condition schema relations grouping params | |
-> Expression schema relations grouping params ty | then |
-> Expression schema relations grouping params ty | else |
-> Expression schema relations grouping params ty |
>>>
:{
let expression :: Expression schema relations grouping params (nullity 'PGint2) expression = ifThenElse true 1 0 in printSQL expression :} CASE WHEN TRUE THEN 1 ELSE 0 END
:: Expression schema relations grouping params (nullity ty) | lhs |
-> Expression schema relations grouping params (nullity ty) | rhs |
-> Expression schema relations grouping params (nullity PGbool) |
:: Expression schema relations grouping params (nullity ty) | lhs |
-> Expression schema relations grouping params (nullity ty) | rhs |
-> Expression schema relations grouping params (nullity PGbool) |
>>>
printSQL $ notNull true ./= null_
(TRUE <> NULL)
:: Expression schema relations grouping params (nullity ty) | lhs |
-> Expression schema relations grouping params (nullity ty) | rhs |
-> Expression schema relations grouping params (nullity PGbool) |
>>>
printSQL $ notNull true .>= null_
(TRUE >= NULL)
:: Expression schema relations grouping params (nullity ty) | lhs |
-> Expression schema relations grouping params (nullity ty) | rhs |
-> Expression schema relations grouping params (nullity PGbool) |
>>>
printSQL $ notNull true .< null_
(TRUE < NULL)
:: Expression schema relations grouping params (nullity ty) | lhs |
-> Expression schema relations grouping params (nullity ty) | rhs |
-> Expression schema relations grouping params (nullity PGbool) |
>>>
printSQL $ notNull true .<= null_
(TRUE <= NULL)
:: Expression schema relations grouping params (nullity ty) | lhs |
-> Expression schema relations grouping params (nullity ty) | rhs |
-> Expression schema relations grouping params (nullity PGbool) |
>>>
printSQL $ notNull true .> null_
(TRUE > NULL)
Time
currentDate :: Expression schema relations grouping params (nullity PGdate) Source #
>>>
printSQL currentDate
CURRENT_DATE
currentTime :: Expression schema relations grouping params (nullity PGtimetz) Source #
>>>
printSQL currentTime
CURRENT_TIME
currentTimestamp :: Expression schema relations grouping params (nullity PGtimestamptz) Source #
>>>
printSQL currentTimestamp
CURRENT_TIMESTAMP
localTime :: Expression schema relations grouping params (nullity PGtime) Source #
>>>
printSQL localTime
LOCALTIME
localTimestamp :: Expression schema relations grouping params (nullity PGtimestamp) Source #
>>>
printSQL localTimestamp
LOCALTIMESTAMP
Text
:: Expression schema relations grouping params (nullity PGtext) | string to lower case |
-> Expression schema relations grouping params (nullity PGtext) |
>>>
printSQL $ lower "ARRRGGG"
lower(E'ARRRGGG')
:: Expression schema relations grouping params (nullity PGtext) | string to upper case |
-> Expression schema relations grouping params (nullity PGtext) |
>>>
printSQL $ upper "eeee"
upper(E'eeee')
:: Expression schema relations grouping params (nullity PGtext) | string to measure |
-> Expression schema relations grouping params (nullity PGint4) |
>>>
printSQL $ charLength "four"
char_length(E'four')
:: Expression schema relations grouping params (nullity PGtext) | string |
-> Expression schema relations grouping params (nullity PGtext) | pattern |
-> Expression schema relations grouping params (nullity PGbool) |
The like
expression returns true if the string
matches
the supplied pattern
. If pattern
does not contain percent signs
or underscores, then the pattern only represents the string itself;
in that case like
acts like the equals operator. An underscore (_)
in pattern stands for (matches) any single character; a percent sign (%)
matches any sequence of zero or more characters.
>>>
printSQL $ "abc" `like` "a%"
(E'abc' LIKE E'a%')
Aggregation
:: ByteString | aggregate function |
-> Expression schema relations Ungrouped params xty | |
-> Expression schema relations (Grouped bys) params yty |
escape hatch to define aggregate functions
unsafeAggregateDistinct Source #
:: ByteString | aggregate function |
-> Expression schema relations Ungrouped params xty | |
-> Expression schema relations (Grouped bys) params yty |
escape hatch to define aggregate functions over distinct values
:: PGNum ty | |
=> Expression schema relations Ungrouped params (nullity ty) | what to sum |
-> Expression schema relations (Grouped bys) params (nullity ty) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: 'Null 'PGnumeric]] ('Grouped bys) params ('Null 'PGnumeric) expression = sum_ #col in printSQL expression :} sum("col")
:: PGNum ty | |
=> Expression schema relations Ungrouped params (nullity ty) | what to sum |
-> Expression schema relations (Grouped bys) params (nullity ty) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGnumeric]] ('Grouped bys) params (nullity 'PGnumeric) expression = sumDistinct #col in printSQL expression :} sum(DISTINCT "col")
class PGAvg ty avg | ty -> avg where Source #
:: Expression schema relations Ungrouped params (nullity ty) | what to average |
-> Expression schema relations (Grouped bys) params (nullity avg) |
:: Expression schema relations Ungrouped params (nullity ty) | what to average |
-> Expression schema relations (Grouped bys) params (nullity avg) |
Instances
PGAvg PGint2 PGnumeric Source # | |
Defined in Squeal.PostgreSQL.Expression avg :: Expression schema relations Ungrouped params (nullity PGint2) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # avgDistinct :: Expression schema relations Ungrouped params (nullity PGint2) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # | |
PGAvg PGint4 PGnumeric Source # | |
Defined in Squeal.PostgreSQL.Expression avg :: Expression schema relations Ungrouped params (nullity PGint4) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # avgDistinct :: Expression schema relations Ungrouped params (nullity PGint4) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # | |
PGAvg PGint8 PGnumeric Source # | |
Defined in Squeal.PostgreSQL.Expression avg :: Expression schema relations Ungrouped params (nullity PGint8) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # avgDistinct :: Expression schema relations Ungrouped params (nullity PGint8) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # | |
PGAvg PGnumeric PGnumeric Source # | |
Defined in Squeal.PostgreSQL.Expression avg :: Expression schema relations Ungrouped params (nullity PGnumeric) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # avgDistinct :: Expression schema relations Ungrouped params (nullity PGnumeric) -> Expression schema relations (Grouped bys) params (nullity PGnumeric) Source # | |
PGAvg PGfloat4 PGfloat8 Source # | |
Defined in Squeal.PostgreSQL.Expression avg :: Expression schema relations Ungrouped params (nullity PGfloat4) -> Expression schema relations (Grouped bys) params (nullity PGfloat8) Source # avgDistinct :: Expression schema relations Ungrouped params (nullity PGfloat4) -> Expression schema relations (Grouped bys) params (nullity PGfloat8) Source # | |
PGAvg PGfloat8 PGfloat8 Source # | |
Defined in Squeal.PostgreSQL.Expression avg :: Expression schema relations Ungrouped params (nullity PGfloat8) -> Expression schema relations (Grouped bys) params (nullity PGfloat8) Source # avgDistinct :: Expression schema relations Ungrouped params (nullity PGfloat8) -> Expression schema relations (Grouped bys) params (nullity PGfloat8) Source # | |
PGAvg PGinterval PGinterval Source # | |
Defined in Squeal.PostgreSQL.Expression avg :: Expression schema relations Ungrouped params (nullity PGinterval) -> Expression schema relations (Grouped bys) params (nullity PGinterval) Source # avgDistinct :: Expression schema relations Ungrouped params (nullity PGinterval) -> Expression schema relations (Grouped bys) params (nullity PGinterval) Source # |
:: PGIntegral int | |
=> Expression schema relations Ungrouped params (nullity int) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity int) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4) expression = bitAnd #col in printSQL expression :} bit_and("col")
:: PGIntegral int | |
=> Expression schema relations Ungrouped params (nullity int) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity int) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4) expression = bitOr #col in printSQL expression :} bit_or("col")
:: Expression schema relations Ungrouped params (nullity PGbool) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity PGbool) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool) expression = boolAnd #col in printSQL expression :} bool_and("col")
:: Expression schema relations Ungrouped params (nullity PGbool) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity PGbool) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool) expression = boolOr #col in printSQL expression :} bool_or("col")
:: PGIntegral int | |
=> Expression schema relations Ungrouped params (nullity int) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity int) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4) expression = bitAndDistinct #col in printSQL expression :} bit_and(DISTINCT "col")
:: PGIntegral int | |
=> Expression schema relations Ungrouped params (nullity int) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity int) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGint4]] (Grouped bys) params (nullity 'PGint4) expression = bitOrDistinct #col in printSQL expression :} bit_or(DISTINCT "col")
:: Expression schema relations Ungrouped params (nullity PGbool) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity PGbool) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool) expression = boolAndDistinct #col in printSQL expression :} bool_and(DISTINCT "col")
:: Expression schema relations Ungrouped params (nullity PGbool) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity PGbool) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool) expression = boolOrDistinct #col in printSQL expression :} bool_or(DISTINCT "col")
countStar :: Expression schema relations (Grouped bys) params (NotNull PGint8) Source #
A special aggregation that does not require an input
>>>
printSQL countStar
count(*)
:: Expression schema relations Ungrouped params ty | what to count |
-> Expression schema relations (Grouped bys) params (NotNull PGint8) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity ty]] (Grouped bys) params ('NotNull 'PGint8) expression = count #col in printSQL expression :} count("col")
:: Expression schema relations Ungrouped params ty | what to count |
-> Expression schema relations (Grouped bys) params (NotNull PGint8) |
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity ty]] (Grouped bys) params ('NotNull 'PGint8) expression = countDistinct #col in printSQL expression :} count(DISTINCT "col")
:: Expression schema relations Ungrouped params (nullity PGbool) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity PGbool) |
synonym for boolAnd
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool) expression = every #col in printSQL expression :} every("col")
:: Expression schema relations Ungrouped params (nullity PGbool) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity PGbool) |
synonym for boolAndDistinct
>>>
:{
let expression :: Expression schema '[tab ::: '["col" ::: nullity 'PGbool]] (Grouped bys) params (nullity 'PGbool) expression = everyDistinct #col in printSQL expression :} every(DISTINCT "col")
:: Expression schema relations Ungrouped params (nullity ty) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity ty) |
minimum and maximum aggregation
:: Expression schema relations Ungrouped params (nullity ty) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity ty) |
minimum and maximum aggregation
:: Expression schema relations Ungrouped params (nullity ty) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity ty) |
minimum and maximum aggregation
:: Expression schema relations Ungrouped params (nullity ty) | what to aggregate |
-> Expression schema relations (Grouped bys) params (nullity ty) |
minimum and maximum aggregation
Types
newtype TypeExpression (schema :: SchemaType) (ty :: PGType) Source #
TypeExpression
s are used in cast
s and createTable
commands.
Instances
class PGTyped schema (ty :: PGType) where Source #
pgtype :: TypeExpression schema ty Source #
Instances
bool :: TypeExpression schema PGbool Source #
logical Boolean (true/false)
int2 :: TypeExpression schema PGint2 Source #
signed two-byte integer
smallint :: TypeExpression schema PGint2 Source #
signed two-byte integer
int4 :: TypeExpression schema PGint4 Source #
signed four-byte integer
int :: TypeExpression schema PGint4 Source #
signed four-byte integer
integer :: TypeExpression schema PGint4 Source #
signed four-byte integer
int8 :: TypeExpression schema PGint8 Source #
signed eight-byte integer
bigint :: TypeExpression schema PGint8 Source #
signed eight-byte integer
numeric :: TypeExpression schema PGnumeric Source #
arbitrary precision numeric type
float4 :: TypeExpression schema PGfloat4 Source #
single precision floating-point number (4 bytes)
real :: TypeExpression schema PGfloat4 Source #
single precision floating-point number (4 bytes)
float8 :: TypeExpression schema PGfloat8 Source #
double precision floating-point number (8 bytes)
doublePrecision :: TypeExpression schema PGfloat8 Source #
double precision floating-point number (8 bytes)
text :: TypeExpression schema PGtext Source #
variable-length character string
char :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGchar n) Source #
fixed-length character string
character :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGchar n) Source #
fixed-length character string
varchar :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGvarchar n) Source #
variable-length character string
characterVarying :: (KnownNat n, 1 <= n) => proxy n -> TypeExpression schema (PGvarchar n) Source #
variable-length character string
bytea :: TypeExpression schema PGbytea Source #
binary data ("byte array")
timestamp :: TypeExpression schema PGtimestamp Source #
date and time (no time zone)
timestampWithTimeZone :: TypeExpression schema PGtimestamptz Source #
date and time, including time zone
date :: TypeExpression schema PGdate Source #
calendar date (year, month, day)
time :: TypeExpression schema PGtime Source #
time of day (no time zone)
timeWithTimeZone :: TypeExpression schema PGtimetz Source #
time of day, including time zone
interval :: TypeExpression schema PGinterval Source #
time span
uuid :: TypeExpression schema PGuuid Source #
universally unique identifier
inet :: TypeExpression schema PGinet Source #
IPv4 or IPv6 host address
json :: TypeExpression schema PGjson Source #
textual JSON data
jsonb :: TypeExpression schema PGjsonb Source #
binary JSON data, decomposed
vararray :: TypeExpression schema pg -> TypeExpression schema (PGvararray pg) Source #
variable length array
fixarray :: KnownNat n => proxy n -> TypeExpression schema pg -> TypeExpression schema (PGfixarray n pg) Source #
fixed length array
>>>
renderTypeExpression (fixarray (Proxy @2) json)
"json[2]"
Re-export
data NP (a :: k -> *) (b :: [k]) :: forall k. (k -> *) -> [k] -> * where #
An n-ary product.
The product is parameterized by a type constructor f
and
indexed by a type-level list xs
. The length of the list
determines the number of elements in the product, and if the
i
-th element of the list is of type x
, then the i
-th
element of the product is of type f x
.
The constructor names are chosen to resemble the names of the list constructors.
Two common instantiations of f
are the identity functor I
and the constant functor K
. For I
, the product becomes a
heterogeneous list, where the type-level list describes the
types of its components. For
, the product becomes a
homogeneous list, where the contents of the type-level list are
ignored, but its length still specifies the number of elements.K
a
In the context of the SOP approach to generic programming, an n-ary product describes the structure of the arguments of a single data constructor.
Examples:
I 'x' :* I True :* Nil :: NP I '[ Char, Bool ] K 0 :* K 1 :* Nil :: NP (K Int) '[ Char, Bool ] Just 'x' :* Nothing :* Nil :: NP Maybe '[ Char, Bool ]
Instances
(Has relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsQualified relation column (NP (Aliased (Expression schema relations (Grouped bys) params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) Source # | |
(Has relation relations columns, Has column columns ty) => IsQualified relation column (NP (Aliased (Expression schema relations Ungrouped params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) Source # | |
(Has rel rels cols, Has col cols ty, bys ~ ((,) rel col ': ([] :: [(Symbol, Symbol)]))) => IsQualified rel col (NP (By rels) bys) Source # | |
HTrans (NP :: (k1 -> *) -> [k1] -> *) (NP :: (k2 -> *) -> [k2] -> *) | |
HPure (NP :: (k -> *) -> [k] -> *) | |
HAp (NP :: (k -> *) -> [k] -> *) | |
HCollapse (NP :: (k -> *) -> [k] -> *) | |
Defined in Generics.SOP.NP | |
HTraverse_ (NP :: (k -> *) -> [k] -> *) | |
Defined in Generics.SOP.NP hctraverse_ :: (AllN NP c xs, Applicative g) => proxy c -> (forall (a :: k0). c a => f a -> g ()) -> NP f xs -> g () # htraverse_ :: (SListIN NP xs, Applicative g) => (forall (a :: k0). f a -> g ()) -> NP f xs -> g () # | |
HSequence (NP :: (k -> *) -> [k] -> *) | |
Defined in Generics.SOP.NP hsequence' :: (SListIN NP xs, Applicative f) => NP (f :.: g) xs -> f (NP g xs) # hctraverse' :: (AllN NP c xs, Applicative g) => proxy c -> (forall (a :: k0). c a => f a -> g (f' a)) -> NP f xs -> g (NP f' xs) # htraverse' :: (SListIN NP xs, Applicative g) => (forall (a :: k0). f a -> g (f' a)) -> NP f xs -> g (NP f' xs) # | |
(KnownSymbol alias, tys ~ ((alias ::: ty) ': ([] :: [(Symbol, k)]))) => Aliasable alias (expression ty) (NP (Aliased expression) tys) Source # | |
aliases ~ (alias ': ([] :: [Symbol])) => IsLabel alias (NP Alias aliases) # | |
Defined in Squeal.PostgreSQL.Schema | |
(HasUnique relation relations columns, Has column columns ty, GroupedBy relation column bys) => IsLabel column (NP (Aliased (Expression schema relations (Grouped bys) params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique relation relations columns, Has column columns ty) => IsLabel column (NP (Aliased (Expression schema relations Ungrouped params)) ((column ::: ty) ': ([] :: [(Symbol, NullityType)]))) # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique rel rels cols, Has col cols ty, bys ~ ((,) rel col ': ([] :: [(Symbol, Symbol)]))) => IsLabel col (NP (By rels) bys) # | |
Defined in Squeal.PostgreSQL.Query | |
labels ~ (label ': ([] :: [Symbol])) => IsPGlabel label (NP PGlabel labels) Source # | |
All (Compose Eq f) xs => Eq (NP f xs) | |
(All (Compose Eq f) xs, All (Compose Ord f) xs) => Ord (NP f xs) | |
All (Compose Show f) xs => Show (NP f xs) | |
All (Compose NFData f) xs => NFData (NP f xs) | Since: generics-sop-0.2.5.0 |
Defined in Generics.SOP.NP | |
type AllZipN (NP :: (k -> *) -> [k] -> *) (c :: a -> b -> Constraint) | |
Defined in Generics.SOP.NP | |
type Same (NP :: (k1 -> *) -> [k1] -> *) | |
type Prod (NP :: (k -> *) -> [k] -> *) | |
type UnProd (NP :: (k -> *) -> [k] -> *) | |
type SListIN (NP :: (k -> *) -> [k] -> *) | |
Defined in Generics.SOP.NP | |
type CollapseTo (NP :: (k -> *) -> [k] -> *) a | |
Defined in Generics.SOP.NP | |
type AllN (NP :: (k -> *) -> [k] -> *) (c :: k -> Constraint) | |
Defined in Generics.SOP.NP |