{-# LANGUAGE
AllowAmbiguousTypes
, ConstraintKinds
, DeriveGeneric
, DerivingStrategies
, FlexibleContexts
, FlexibleInstances
, FunctionalDependencies
, GADTs
, GeneralizedNewtypeDeriving
, LambdaCase
, MagicHash
, OverloadedStrings
, ScopedTypeVariables
, StandaloneDeriving
, TypeApplications
, TypeFamilies
, DataKinds
, PolyKinds
, TypeOperators
, UndecidableInstances
, RankNTypes
#-}
module Squeal.PostgreSQL.Expression
(
Expression (..)
, Expr
, type (-->)
, Fun
, unsafeFunction
, function
, unsafeLeftOp
, unsafeRightOp
, Operator
, OperatorDB
, unsafeBinaryOp
, PGSubset (..)
, PGIntersect (..)
, FunctionVar
, unsafeFunctionVar
, type (--->)
, FunN
, unsafeFunctionN
, functionN
, (&)
) where
import Control.Category
import Control.DeepSeq
import Data.Binary.Builder (toLazyByteString)
import Data.ByteString (ByteString)
import Data.ByteString.Builder (doubleDec, floatDec, int16Dec, int32Dec, int64Dec)
import Data.ByteString.Builder.Scientific (scientificBuilder)
import Data.ByteString.Lazy (toStrict)
import Data.Function ((&))
import Data.Semigroup hiding (All)
import Data.String
import Generics.SOP hiding (All, from)
import GHC.OverloadedLabels
import GHC.TypeLits
import Numeric
import Prelude hiding (id, (.))
import qualified GHC.Generics as GHC
import Squeal.PostgreSQL.Type.Alias
import Squeal.PostgreSQL.Type.List
import Squeal.PostgreSQL.Render
import Squeal.PostgreSQL.Type.Schema
newtype Expression
(grp :: Grouping)
(lat :: FromType)
(with :: FromType)
(db :: SchemasType)
(params :: [NullType])
(from :: FromType)
(ty :: NullType)
= UnsafeExpression { forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty -> ByteString
renderExpression :: ByteString }
deriving stock (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType) x.
Rep (Expression grp lat with db params from ty) x
-> Expression grp lat with db params from ty
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType) x.
Expression grp lat with db params from ty
-> Rep (Expression grp lat with db params from ty) x
$cto :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType) x.
Rep (Expression grp lat with db params from ty) x
-> Expression grp lat with db params from ty
$cfrom :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType) x.
Expression grp lat with db params from ty
-> Rep (Expression grp lat with db params from ty) x
GHC.Generic,Int -> Expression grp lat with db params from ty -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Int -> Expression grp lat with db params from ty -> ShowS
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
[Expression grp lat with db params from ty] -> ShowS
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty -> String
showList :: [Expression grp lat with db params from ty] -> ShowS
$cshowList :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
[Expression grp lat with db params from ty] -> ShowS
show :: Expression grp lat with db params from ty -> String
$cshow :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty -> String
showsPrec :: Int -> Expression grp lat with db params from ty -> ShowS
$cshowsPrec :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Int -> Expression grp lat with db params from ty -> ShowS
Show,Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
/= :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
$c/= :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
== :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
$c== :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
Eq,Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Eq (Expression grp lat with db params from ty)
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Ordering
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
min :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
$cmin :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
max :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
$cmax :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
-> Expression grp lat with db params from ty
>= :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
$c>= :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
> :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
$c> :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
<= :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
$c<= :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
< :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
$c< :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Bool
compare :: Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Ordering
$ccompare :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty
-> Expression grp lat with db params from ty -> Ordering
Ord)
deriving newtype (Expression grp lat with db params from ty -> ()
forall a. (a -> ()) -> NFData a
forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty -> ()
rnf :: Expression grp lat with db params from ty -> ()
$crnf :: forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty -> ()
NFData)
instance RenderSQL (Expression grp lat with db params from ty) where
renderSQL :: Expression grp lat with db params from ty -> ByteString
renderSQL = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
Expression grp lat with db params from ty -> ByteString
renderExpression
type Expr x
= forall grp lat with db params from
. Expression grp lat with db params from x
type Operator x1 x2 y = forall db. OperatorDB db x1 x2 y
type OperatorDB db x1 x2 y
= forall grp lat with params from
. Expression grp lat with db params from x1
-> Expression grp lat with db params from x2
-> Expression grp lat with db params from y
type (-->) x y = forall db. Fun db x y
type Fun db x y
= forall grp lat with params from
. Expression grp lat with db params from x
-> Expression grp lat with db params from y
type (--->) xs y = forall db. FunN db xs y
type FunN db xs y
= forall grp lat with params from
. NP (Expression grp lat with db params from) xs
-> Expression grp lat with db params from y
type FunctionVar x0 x1 y
= forall grp lat with db params from
. [Expression grp lat with db params from x0]
-> Expression grp lat with db params from x1
-> Expression grp lat with db params from y
unsafeFunctionVar :: ByteString -> FunctionVar x0 x1 y
unsafeFunctionVar :: forall (x0 :: NullType) (x1 :: NullType) (y :: NullType).
ByteString -> FunctionVar x0 x1 y
unsafeFunctionVar ByteString
fun [Expression grp lat with db params from x0]
xs Expression grp lat with db params from x1
x = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$ ByteString
fun forall a. Semigroup a => a -> a -> a
<> ByteString -> ByteString
parenthesized
([ByteString] -> ByteString
commaSeparated (forall sql. RenderSQL sql => sql -> ByteString
renderSQL forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Expression grp lat with db params from x0]
xs) forall a. Semigroup a => a -> a -> a
<> ByteString
", " forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from x1
x)
instance (HasUnique tab (Join from lat) row, Has col row ty)
=> IsLabel col (Expression 'Ungrouped lat with db params from ty) where
fromLabel :: Expression 'Ungrouped lat with db params from ty
fromLabel = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$ forall sql. RenderSQL sql => sql -> ByteString
renderSQL (forall (alias :: Symbol). Alias alias
Alias @col)
instance (HasUnique tab (Join from lat) row, Has col row ty, tys ~ '[ty])
=> IsLabel col (NP (Expression 'Ungrouped lat with db params from) tys) where
fromLabel :: NP (Expression 'Ungrouped lat with db params from) tys
fromLabel = forall (x :: Symbol) a. IsLabel x a => a
fromLabel @col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance (HasUnique tab (Join from lat) row, Has col row ty, column ~ (col ::: ty))
=> IsLabel col
(Aliased (Expression 'Ungrouped lat with db params from) column) where
fromLabel :: Aliased (Expression 'Ungrouped lat with db params from) column
fromLabel = forall (x :: Symbol) a. IsLabel x a => a
fromLabel @col forall {k} (alias :: Symbol) (expression :: k -> *) (ty :: k).
KnownSymbol alias =>
expression ty -> Alias alias -> Aliased expression (alias ::: ty)
`As` forall (alias :: Symbol). Alias alias
Alias
instance (HasUnique tab (Join from lat) row, Has col row ty, columns ~ '[col ::: ty])
=> IsLabel col
(NP (Aliased (Expression 'Ungrouped lat with db params from)) columns) where
fromLabel :: NP
(Aliased (Expression 'Ungrouped lat with db params from)) columns
fromLabel = forall (x :: Symbol) a. IsLabel x a => a
fromLabel @col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance (Has tab (Join from lat) row, Has col row ty)
=> IsQualified tab col (Expression 'Ungrouped lat with db params from ty) where
Alias tab
tab ! :: Alias tab
-> Alias col -> Expression 'Ungrouped lat with db params from ty
! Alias col
col = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$
forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias tab
tab forall a. Semigroup a => a -> a -> a
<> ByteString
"." forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias col
col
instance (Has tab (Join from lat) row, Has col row ty, tys ~ '[ty])
=> IsQualified tab col (NP (Expression 'Ungrouped lat with db params from) tys) where
Alias tab
tab ! :: Alias tab
-> Alias col
-> NP (Expression 'Ungrouped lat with db params from) tys
! Alias col
col = Alias tab
tab forall (qualifier :: Symbol) (alias :: Symbol) expression.
IsQualified qualifier alias expression =>
Alias qualifier -> Alias alias -> expression
! Alias col
col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance (Has tab (Join from lat) row, Has col row ty, column ~ (col ::: ty))
=> IsQualified tab col
(Aliased (Expression 'Ungrouped lat with db params from) column) where
Alias tab
tab ! :: Alias tab
-> Alias col
-> Aliased (Expression 'Ungrouped lat with db params from) column
! Alias col
col = Alias tab
tab forall (qualifier :: Symbol) (alias :: Symbol) expression.
IsQualified qualifier alias expression =>
Alias qualifier -> Alias alias -> expression
! Alias col
col forall {k} (alias :: Symbol) (expression :: k -> *) (ty :: k).
KnownSymbol alias =>
expression ty -> Alias alias -> Aliased expression (alias ::: ty)
`As` Alias col
col
instance (Has tab (Join from lat) row, Has col row ty, columns ~ '[col ::: ty])
=> IsQualified tab col
(NP (Aliased (Expression 'Ungrouped lat with db params from)) columns) where
Alias tab
tab ! :: Alias tab
-> Alias col
-> NP
(Aliased (Expression 'Ungrouped lat with db params from)) columns
! Alias col
col = Alias tab
tab forall (qualifier :: Symbol) (alias :: Symbol) expression.
IsQualified qualifier alias expression =>
Alias qualifier -> Alias alias -> expression
! Alias col
col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance
( HasUnique tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
) => IsLabel col
(Expression ('Grouped bys) lat with db params from ty) where
fromLabel :: Expression ('Grouped bys) lat with db params from ty
fromLabel = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$ forall sql. RenderSQL sql => sql -> ByteString
renderSQL (forall (alias :: Symbol). Alias alias
Alias @col)
instance
( HasUnique tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
, tys ~ '[ty]
) => IsLabel col
(NP (Expression ('Grouped bys) lat with db params from) tys) where
fromLabel :: NP (Expression ('Grouped bys) lat with db params from) tys
fromLabel = forall (x :: Symbol) a. IsLabel x a => a
fromLabel @col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance
( HasUnique tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
, column ~ (col ::: ty)
) => IsLabel col
(Aliased (Expression ('Grouped bys) lat with db params from) column) where
fromLabel :: Aliased (Expression ('Grouped bys) lat with db params from) column
fromLabel = forall (x :: Symbol) a. IsLabel x a => a
fromLabel @col forall {k} (alias :: Symbol) (expression :: k -> *) (ty :: k).
KnownSymbol alias =>
expression ty -> Alias alias -> Aliased expression (alias ::: ty)
`As` forall (alias :: Symbol). Alias alias
Alias
instance
( HasUnique tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
, columns ~ '[col ::: ty]
) => IsLabel col
(NP (Aliased (Expression ('Grouped bys) lat with db params from)) columns) where
fromLabel :: NP
(Aliased (Expression ('Grouped bys) lat with db params from))
columns
fromLabel = forall (x :: Symbol) a. IsLabel x a => a
fromLabel @col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance
( Has tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
) => IsQualified tab col
(Expression ('Grouped bys) lat with db params from ty) where
Alias tab
tab ! :: Alias tab
-> Alias col
-> Expression ('Grouped bys) lat with db params from ty
! Alias col
col = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$
forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias tab
tab forall a. Semigroup a => a -> a -> a
<> ByteString
"." forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias col
col
instance
( Has tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
, tys ~ '[ty]
) => IsQualified tab col
(NP (Expression ('Grouped bys) lat with db params from) tys) where
Alias tab
tab ! :: Alias tab
-> Alias col
-> NP (Expression ('Grouped bys) lat with db params from) tys
! Alias col
col = Alias tab
tab forall (qualifier :: Symbol) (alias :: Symbol) expression.
IsQualified qualifier alias expression =>
Alias qualifier -> Alias alias -> expression
! Alias col
col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance
( Has tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
, column ~ (col ::: ty)
) => IsQualified tab col
(Aliased (Expression ('Grouped bys) lat with db params from) column) where
Alias tab
tab ! :: Alias tab
-> Alias col
-> Aliased
(Expression ('Grouped bys) lat with db params from) column
! Alias col
col = Alias tab
tab forall (qualifier :: Symbol) (alias :: Symbol) expression.
IsQualified qualifier alias expression =>
Alias qualifier -> Alias alias -> expression
! Alias col
col forall {k} (alias :: Symbol) (expression :: k -> *) (ty :: k).
KnownSymbol alias =>
expression ty -> Alias alias -> Aliased expression (alias ::: ty)
`As` Alias col
col
instance
( Has tab (Join from lat) row
, Has col row ty
, GroupedBy tab col bys
, columns ~ '[col ::: ty]
) => IsQualified tab col
(NP (Aliased (Expression ('Grouped bys) lat with db params from)) columns) where
Alias tab
tab ! :: Alias tab
-> Alias col
-> NP
(Aliased (Expression ('Grouped bys) lat with db params from))
columns
! Alias col
col = Alias tab
tab forall (qualifier :: Symbol) (alias :: Symbol) expression.
IsQualified qualifier alias expression =>
Alias qualifier -> Alias alias -> expression
! Alias col
col forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
:* forall {k} (a :: k -> *). NP a '[]
Nil
instance (KnownSymbol label, label `In` labels) => IsPGlabel label
(Expression grp lat with db params from (null ('PGenum labels))) where
label :: Expression grp lat with db params from (null ('PGenum labels))
label = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$ forall sql. RenderSQL sql => sql -> ByteString
renderSQL (forall (label :: Symbol). PGlabel label
PGlabel @label)
unsafeBinaryOp :: ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp :: forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
op Expression grp lat with db params from ty0
x Expression grp lat with db params from ty1
y = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
parenthesized forall a b. (a -> b) -> a -> b
$
forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from ty0
x ByteString -> ByteString -> ByteString
<+> ByteString
op ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from ty1
y
unsafeLeftOp :: ByteString -> x --> y
unsafeLeftOp :: forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeLeftOp ByteString
op Expression grp lat with db params from x
x = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
parenthesized forall a b. (a -> b) -> a -> b
$ ByteString
op ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from x
x
unsafeRightOp :: ByteString -> x --> y
unsafeRightOp :: forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeRightOp ByteString
op Expression grp lat with db params from x
x = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
parenthesized forall a b. (a -> b) -> a -> b
$ forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from x
x ByteString -> ByteString -> ByteString
<+> ByteString
op
unsafeFunction :: ByteString -> x --> y
unsafeFunction :: forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
fun Expression grp lat with db params from x
x = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$
ByteString
fun forall a. Semigroup a => a -> a -> a
<> ByteString -> ByteString
parenthesized (forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from x
x)
function
:: (Has sch db schema, Has fun schema ('Function ('[x] :=> 'Returns y)))
=> QualifiedAlias sch fun
-> Fun db x y
function :: forall (sch :: Symbol) (db :: SchemasType)
(schema :: [(Symbol, SchemumType)]) (fun :: Symbol) (x :: NullType)
(y :: NullType).
(Has sch db schema,
Has fun schema ('Function ('[x] :=> 'Returns y))) =>
QualifiedAlias sch fun -> Fun db x y
function QualifiedAlias sch fun
f = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction forall a b. (a -> b) -> a -> b
$ forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch fun
f
unsafeFunctionN :: SListI xs => ByteString -> xs ---> y
unsafeFunctionN :: forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
fun NP (Expression grp lat with db params from) xs
xs = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$
ByteString
fun forall a. Semigroup a => a -> a -> a
<> ByteString -> ByteString
parenthesized (forall {k} (xs :: [k]) (expression :: k -> *).
SListI xs =>
(forall (x :: k). expression x -> ByteString)
-> NP expression xs -> ByteString
renderCommaSeparated forall sql. RenderSQL sql => sql -> ByteString
renderSQL NP (Expression grp lat with db params from) xs
xs)
functionN
:: ( Has sch db schema
, Has fun schema ('Function (xs :=> 'Returns y))
, SListI xs )
=> QualifiedAlias sch fun
-> FunN db xs y
functionN :: forall (sch :: Symbol) (db :: SchemasType)
(schema :: [(Symbol, SchemumType)]) (fun :: Symbol)
(xs :: [NullType]) (y :: NullType).
(Has sch db schema, Has fun schema ('Function (xs :=> 'Returns y)),
SListI xs) =>
QualifiedAlias sch fun -> FunN db xs y
functionN QualifiedAlias sch fun
f = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN forall a b. (a -> b) -> a -> b
$ forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch fun
f
instance
Num (Expression grp lat with db params from (null 'PGint2)) where
+ :: Expression grp lat with db params from (null 'PGint2)
-> Expression grp lat with db params from (null 'PGint2)
-> Expression grp lat with db params from (null 'PGint2)
(+) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"+"
(-) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"-"
* :: Expression grp lat with db params from (null 'PGint2)
-> Expression grp lat with db params from (null 'PGint2)
-> Expression grp lat with db params from (null 'PGint2)
(*) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"*"
abs :: Expression grp lat with db params from (null 'PGint2)
-> Expression grp lat with db params from (null 'PGint2)
abs = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"abs"
signum :: Expression grp lat with db params from (null 'PGint2)
-> Expression grp lat with db params from (null 'PGint2)
signum = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sign"
fromInteger :: Integer -> Expression grp lat with db params from (null 'PGint2)
fromInteger
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: int2")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
toStrict
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Int16 -> Builder
int16Dec
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Num a => Integer -> a
fromInteger
instance
Num (Expression grp lat with db params from (null 'PGint4)) where
+ :: Expression grp lat with db params from (null 'PGint4)
-> Expression grp lat with db params from (null 'PGint4)
-> Expression grp lat with db params from (null 'PGint4)
(+) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"+"
(-) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"-"
* :: Expression grp lat with db params from (null 'PGint4)
-> Expression grp lat with db params from (null 'PGint4)
-> Expression grp lat with db params from (null 'PGint4)
(*) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"*"
abs :: Expression grp lat with db params from (null 'PGint4)
-> Expression grp lat with db params from (null 'PGint4)
abs = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"abs"
signum :: Expression grp lat with db params from (null 'PGint4)
-> Expression grp lat with db params from (null 'PGint4)
signum = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sign"
fromInteger :: Integer -> Expression grp lat with db params from (null 'PGint4)
fromInteger
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: int4")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
toStrict
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Int32 -> Builder
int32Dec
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Num a => Integer -> a
fromInteger
instance
Num (Expression grp lat with db params from (null 'PGint8)) where
+ :: Expression grp lat with db params from (null 'PGint8)
-> Expression grp lat with db params from (null 'PGint8)
-> Expression grp lat with db params from (null 'PGint8)
(+) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"+"
(-) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"-"
* :: Expression grp lat with db params from (null 'PGint8)
-> Expression grp lat with db params from (null 'PGint8)
-> Expression grp lat with db params from (null 'PGint8)
(*) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"*"
abs :: Expression grp lat with db params from (null 'PGint8)
-> Expression grp lat with db params from (null 'PGint8)
abs = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"abs"
signum :: Expression grp lat with db params from (null 'PGint8)
-> Expression grp lat with db params from (null 'PGint8)
signum = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sign"
fromInteger :: Integer -> Expression grp lat with db params from (null 'PGint8)
fromInteger Integer
x =
let
y :: Int64
y = forall a. Num a => Integer -> a
fromInteger Integer
x
in
if Int64
y forall a. Eq a => a -> a -> Bool
== forall a. Bounded a => a
minBound
then forall a. Num a => Integer -> a
fromInteger (Integer
xforall a. Num a => a -> a -> a
+Integer
1) forall a. Num a => a -> a -> a
- Expression grp lat with db params from (null 'PGint8)
1
else forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: int8")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
toStrict
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString
forall a b. (a -> b) -> a -> b
$ Int64 -> Builder
int64Dec Int64
y
instance
Num (Expression grp lat with db params from (null 'PGfloat4)) where
+ :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
(+) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"+"
(-) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"-"
* :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
(*) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"*"
abs :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
abs = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"abs"
signum :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
signum = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sign"
fromInteger :: Integer -> Expression grp lat with db params from (null 'PGfloat4)
fromInteger Integer
x
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: float4") forall a b. (a -> b) -> a -> b
$
let
y :: Float
y = forall a. Num a => Integer -> a
fromInteger Integer
x
decimal :: Float -> ByteString
decimal = ByteString -> ByteString
toStrict forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Float -> Builder
floatDec
in
if forall a. RealFloat a => a -> Bool
isNaN Float
y Bool -> Bool -> Bool
|| forall a. RealFloat a => a -> Bool
isInfinite Float
y
then ByteString -> ByteString
singleQuotedUtf8 (Float -> ByteString
decimal Float
y)
else Float -> ByteString
decimal Float
y
instance
Num (Expression grp lat with db params from (null 'PGfloat8)) where
+ :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
(+) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"+"
(-) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"-"
* :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
(*) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"*"
abs :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
abs = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"abs"
signum :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
signum = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sign"
fromInteger :: Integer -> Expression grp lat with db params from (null 'PGfloat8)
fromInteger Integer
x
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: float8") forall a b. (a -> b) -> a -> b
$
let
y :: Double
y = forall a. Num a => Integer -> a
fromInteger Integer
x
decimal :: Double -> ByteString
decimal = ByteString -> ByteString
toStrict forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Double -> Builder
doubleDec
in
if forall a. RealFloat a => a -> Bool
isNaN Double
y Bool -> Bool -> Bool
|| forall a. RealFloat a => a -> Bool
isInfinite Double
y
then ByteString -> ByteString
singleQuotedUtf8 (Double -> ByteString
decimal Double
y)
else Double -> ByteString
decimal Double
y
instance
Num (Expression grp lat with db params from (null 'PGnumeric)) where
+ :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
(+) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"+"
(-) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"-"
* :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
(*) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"*"
abs :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
abs = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"abs"
signum :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
signum = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sign"
fromInteger :: Integer -> Expression grp lat with db params from (null 'PGnumeric)
fromInteger
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: numeric")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
toStrict
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Scientific -> Builder
scientificBuilder
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Num a => Integer -> a
fromInteger
instance Fractional
(Expression grp lat with db params from (null 'PGfloat4)) where
/ :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
(/) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"/"
fromRational :: Rational -> Expression grp lat with db params from (null 'PGfloat4)
fromRational Rational
x
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: float4") forall a b. (a -> b) -> a -> b
$
let
y :: Float
y = forall a. Fractional a => Rational -> a
fromRational Rational
x
decimal :: Float -> ByteString
decimal = ByteString -> ByteString
toStrict forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Float -> Builder
floatDec
in
if forall a. RealFloat a => a -> Bool
isNaN Float
y Bool -> Bool -> Bool
|| forall a. RealFloat a => a -> Bool
isInfinite Float
y
then ByteString -> ByteString
singleQuotedUtf8 (Float -> ByteString
decimal Float
y)
else Float -> ByteString
decimal Float
y
instance Fractional
(Expression grp lat with db params from (null 'PGfloat8)) where
/ :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
(/) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"/"
fromRational :: Rational -> Expression grp lat with db params from (null 'PGfloat8)
fromRational Rational
x
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: float8") forall a b. (a -> b) -> a -> b
$
let
y :: Double
y = forall a. Fractional a => Rational -> a
fromRational Rational
x
decimal :: Double -> ByteString
decimal = ByteString -> ByteString
toStrict forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Double -> Builder
doubleDec
in
if forall a. RealFloat a => a -> Bool
isNaN Double
y Bool -> Bool -> Bool
|| forall a. RealFloat a => a -> Bool
isInfinite Double
y
then ByteString -> ByteString
singleQuotedUtf8 (Double -> ByteString
decimal Double
y)
else Double -> ByteString
decimal Double
y
instance Fractional
(Expression grp lat with db params from (null 'PGnumeric)) where
/ :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
(/) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"/"
fromRational :: Rational
-> Expression grp lat with db params from (null 'PGnumeric)
fromRational
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: numeric")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
toStrict
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Builder -> ByteString
toLazyByteString
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Scientific -> Builder
scientificBuilder
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. Fractional a => Rational -> a
fromRational
instance Floating
(Expression grp lat with db params from (null 'PGfloat4)) where
pi :: Expression grp lat with db params from (null 'PGfloat4)
pi = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression ByteString
"pi()"
exp :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
exp = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"exp"
log :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
log = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"ln"
sqrt :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
sqrt = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sqrt"
Expression grp lat with db params from (null 'PGfloat4)
b ** :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
** Expression grp lat with db params from (null 'PGfloat4)
x = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$
ByteString
"power(" forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from (null 'PGfloat4)
b forall a. Semigroup a => a -> a -> a
<> ByteString
", " forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from (null 'PGfloat4)
x forall a. Semigroup a => a -> a -> a
<> ByteString
")"
logBase :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
logBase Expression grp lat with db params from (null 'PGfloat4)
b Expression grp lat with db params from (null 'PGfloat4)
y = forall a. Floating a => a -> a
log Expression grp lat with db params from (null 'PGfloat4)
y forall a. Fractional a => a -> a -> a
/ forall a. Floating a => a -> a
log Expression grp lat with db params from (null 'PGfloat4)
b
sin :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
sin = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sin"
cos :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
cos = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"cos"
tan :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
tan = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"tan"
asin :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
asin = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"asin"
acos :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
acos = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"acos"
atan :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
atan = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"atan"
sinh :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
sinh Expression grp lat with db params from (null 'PGfloat4)
x = (forall a. Floating a => a -> a
exp Expression grp lat with db params from (null 'PGfloat4)
x forall a. Num a => a -> a -> a
- forall a. Floating a => a -> a
exp (-Expression grp lat with db params from (null 'PGfloat4)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGfloat4)
2
cosh :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
cosh Expression grp lat with db params from (null 'PGfloat4)
x = (forall a. Floating a => a -> a
exp Expression grp lat with db params from (null 'PGfloat4)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
exp (-Expression grp lat with db params from (null 'PGfloat4)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGfloat4)
2
tanh :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
tanh Expression grp lat with db params from (null 'PGfloat4)
x = forall a. Floating a => a -> a
sinh Expression grp lat with db params from (null 'PGfloat4)
x forall a. Fractional a => a -> a -> a
/ forall a. Floating a => a -> a
cosh Expression grp lat with db params from (null 'PGfloat4)
x
asinh :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
asinh Expression grp lat with db params from (null 'PGfloat4)
x = forall a. Floating a => a -> a
log (Expression grp lat with db params from (null 'PGfloat4)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
sqrt (Expression grp lat with db params from (null 'PGfloat4)
xforall a. Num a => a -> a -> a
*Expression grp lat with db params from (null 'PGfloat4)
x forall a. Num a => a -> a -> a
+ Expression grp lat with db params from (null 'PGfloat4)
1))
acosh :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
acosh Expression grp lat with db params from (null 'PGfloat4)
x = forall a. Floating a => a -> a
log (Expression grp lat with db params from (null 'PGfloat4)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
sqrt (Expression grp lat with db params from (null 'PGfloat4)
xforall a. Num a => a -> a -> a
*Expression grp lat with db params from (null 'PGfloat4)
x forall a. Num a => a -> a -> a
- Expression grp lat with db params from (null 'PGfloat4)
1))
atanh :: Expression grp lat with db params from (null 'PGfloat4)
-> Expression grp lat with db params from (null 'PGfloat4)
atanh Expression grp lat with db params from (null 'PGfloat4)
x = forall a. Floating a => a -> a
log ((Expression grp lat with db params from (null 'PGfloat4)
1 forall a. Num a => a -> a -> a
+ Expression grp lat with db params from (null 'PGfloat4)
x) forall a. Fractional a => a -> a -> a
/ (Expression grp lat with db params from (null 'PGfloat4)
1 forall a. Num a => a -> a -> a
- Expression grp lat with db params from (null 'PGfloat4)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGfloat4)
2
instance Floating
(Expression grp lat with db params from (null 'PGfloat8)) where
pi :: Expression grp lat with db params from (null 'PGfloat8)
pi = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression ByteString
"pi()"
exp :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
exp = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"exp"
log :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
log = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"ln"
sqrt :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
sqrt = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sqrt"
Expression grp lat with db params from (null 'PGfloat8)
b ** :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
** Expression grp lat with db params from (null 'PGfloat8)
x = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$
ByteString
"power(" forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from (null 'PGfloat8)
b forall a. Semigroup a => a -> a -> a
<> ByteString
", " forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from (null 'PGfloat8)
x forall a. Semigroup a => a -> a -> a
<> ByteString
")"
logBase :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
logBase Expression grp lat with db params from (null 'PGfloat8)
b Expression grp lat with db params from (null 'PGfloat8)
y = forall a. Floating a => a -> a
log Expression grp lat with db params from (null 'PGfloat8)
y forall a. Fractional a => a -> a -> a
/ forall a. Floating a => a -> a
log Expression grp lat with db params from (null 'PGfloat8)
b
sin :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
sin = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sin"
cos :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
cos = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"cos"
tan :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
tan = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"tan"
asin :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
asin = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"asin"
acos :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
acos = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"acos"
atan :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
atan = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"atan"
sinh :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
sinh Expression grp lat with db params from (null 'PGfloat8)
x = (forall a. Floating a => a -> a
exp Expression grp lat with db params from (null 'PGfloat8)
x forall a. Num a => a -> a -> a
- forall a. Floating a => a -> a
exp (-Expression grp lat with db params from (null 'PGfloat8)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGfloat8)
2
cosh :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
cosh Expression grp lat with db params from (null 'PGfloat8)
x = (forall a. Floating a => a -> a
exp Expression grp lat with db params from (null 'PGfloat8)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
exp (-Expression grp lat with db params from (null 'PGfloat8)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGfloat8)
2
tanh :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
tanh Expression grp lat with db params from (null 'PGfloat8)
x = forall a. Floating a => a -> a
sinh Expression grp lat with db params from (null 'PGfloat8)
x forall a. Fractional a => a -> a -> a
/ forall a. Floating a => a -> a
cosh Expression grp lat with db params from (null 'PGfloat8)
x
asinh :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
asinh Expression grp lat with db params from (null 'PGfloat8)
x = forall a. Floating a => a -> a
log (Expression grp lat with db params from (null 'PGfloat8)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
sqrt (Expression grp lat with db params from (null 'PGfloat8)
xforall a. Num a => a -> a -> a
*Expression grp lat with db params from (null 'PGfloat8)
x forall a. Num a => a -> a -> a
+ Expression grp lat with db params from (null 'PGfloat8)
1))
acosh :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
acosh Expression grp lat with db params from (null 'PGfloat8)
x = forall a. Floating a => a -> a
log (Expression grp lat with db params from (null 'PGfloat8)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
sqrt (Expression grp lat with db params from (null 'PGfloat8)
xforall a. Num a => a -> a -> a
*Expression grp lat with db params from (null 'PGfloat8)
x forall a. Num a => a -> a -> a
- Expression grp lat with db params from (null 'PGfloat8)
1))
atanh :: Expression grp lat with db params from (null 'PGfloat8)
-> Expression grp lat with db params from (null 'PGfloat8)
atanh Expression grp lat with db params from (null 'PGfloat8)
x = forall a. Floating a => a -> a
log ((Expression grp lat with db params from (null 'PGfloat8)
1 forall a. Num a => a -> a -> a
+ Expression grp lat with db params from (null 'PGfloat8)
x) forall a. Fractional a => a -> a -> a
/ (Expression grp lat with db params from (null 'PGfloat8)
1 forall a. Num a => a -> a -> a
- Expression grp lat with db params from (null 'PGfloat8)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGfloat8)
2
instance Floating
(Expression grp lat with db params from (null 'PGnumeric)) where
pi :: Expression grp lat with db params from (null 'PGnumeric)
pi = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression ByteString
"pi()"
exp :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
exp = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"exp"
log :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
log = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"ln"
sqrt :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
sqrt = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sqrt"
Expression grp lat with db params from (null 'PGnumeric)
b ** :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
** Expression grp lat with db params from (null 'PGnumeric)
x = forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression forall a b. (a -> b) -> a -> b
$
ByteString
"power(" forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from (null 'PGnumeric)
b forall a. Semigroup a => a -> a -> a
<> ByteString
", " forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression grp lat with db params from (null 'PGnumeric)
x forall a. Semigroup a => a -> a -> a
<> ByteString
")"
logBase :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
logBase Expression grp lat with db params from (null 'PGnumeric)
b Expression grp lat with db params from (null 'PGnumeric)
y = forall a. Floating a => a -> a
log Expression grp lat with db params from (null 'PGnumeric)
y forall a. Fractional a => a -> a -> a
/ forall a. Floating a => a -> a
log Expression grp lat with db params from (null 'PGnumeric)
b
sin :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
sin = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"sin"
cos :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
cos = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"cos"
tan :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
tan = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"tan"
asin :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
asin = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"asin"
acos :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
acos = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"acos"
atan :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
atan = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"atan"
sinh :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
sinh Expression grp lat with db params from (null 'PGnumeric)
x = (forall a. Floating a => a -> a
exp Expression grp lat with db params from (null 'PGnumeric)
x forall a. Num a => a -> a -> a
- forall a. Floating a => a -> a
exp (-Expression grp lat with db params from (null 'PGnumeric)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGnumeric)
2
cosh :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
cosh Expression grp lat with db params from (null 'PGnumeric)
x = (forall a. Floating a => a -> a
exp Expression grp lat with db params from (null 'PGnumeric)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
exp (-Expression grp lat with db params from (null 'PGnumeric)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGnumeric)
2
tanh :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
tanh Expression grp lat with db params from (null 'PGnumeric)
x = forall a. Floating a => a -> a
sinh Expression grp lat with db params from (null 'PGnumeric)
x forall a. Fractional a => a -> a -> a
/ forall a. Floating a => a -> a
cosh Expression grp lat with db params from (null 'PGnumeric)
x
asinh :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
asinh Expression grp lat with db params from (null 'PGnumeric)
x = forall a. Floating a => a -> a
log (Expression grp lat with db params from (null 'PGnumeric)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
sqrt (Expression grp lat with db params from (null 'PGnumeric)
xforall a. Num a => a -> a -> a
*Expression grp lat with db params from (null 'PGnumeric)
x forall a. Num a => a -> a -> a
+ Expression grp lat with db params from (null 'PGnumeric)
1))
acosh :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
acosh Expression grp lat with db params from (null 'PGnumeric)
x = forall a. Floating a => a -> a
log (Expression grp lat with db params from (null 'PGnumeric)
x forall a. Num a => a -> a -> a
+ forall a. Floating a => a -> a
sqrt (Expression grp lat with db params from (null 'PGnumeric)
xforall a. Num a => a -> a -> a
*Expression grp lat with db params from (null 'PGnumeric)
x forall a. Num a => a -> a -> a
- Expression grp lat with db params from (null 'PGnumeric)
1))
atanh :: Expression grp lat with db params from (null 'PGnumeric)
-> Expression grp lat with db params from (null 'PGnumeric)
atanh Expression grp lat with db params from (null 'PGnumeric)
x = forall a. Floating a => a -> a
log ((Expression grp lat with db params from (null 'PGnumeric)
1 forall a. Num a => a -> a -> a
+ Expression grp lat with db params from (null 'PGnumeric)
x) forall a. Fractional a => a -> a -> a
/ (Expression grp lat with db params from (null 'PGnumeric)
1 forall a. Num a => a -> a -> a
- Expression grp lat with db params from (null 'PGnumeric)
x)) forall a. Fractional a => a -> a -> a
/ Expression grp lat with db params from (null 'PGnumeric)
2
class PGSubset ty where
(@>) :: Operator (null0 ty) (null1 ty) ('Null 'PGbool)
(@>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"@>"
(<@) :: Operator (null0 ty) (null1 ty) ('Null 'PGbool)
(<@) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"<@"
infix 4 @>
infix 4 <@
instance PGSubset 'PGjsonb
instance PGSubset 'PGtsquery
instance PGSubset ('PGvararray ty)
instance PGSubset ('PGrange ty)
class PGIntersect ty where
(@&&) :: Operator (null0 ty) (null1 ty) ('Null 'PGbool)
(@&&) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"&&"
instance PGIntersect ('PGvararray ty)
instance PGIntersect ('PGrange ty)
instance IsString
(Expression grp lat with db params from (null 'PGtext)) where
fromString :: String -> Expression grp lat with db params from (null 'PGtext)
fromString
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: text")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
escapeQuotedString
instance IsString
(Expression grp lat with db params from (null 'PGtsvector)) where
fromString :: String -> Expression grp lat with db params from (null 'PGtsvector)
fromString
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: tsvector")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
escapeQuotedString
instance IsString
(Expression grp lat with db params from (null 'PGtsquery)) where
fromString :: String -> Expression grp lat with db params from (null 'PGtsquery)
fromString
= forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: SchemasType) (params :: [NullType]) (from :: FromType)
(ty :: NullType).
ByteString -> Expression grp lat with db params from ty
UnsafeExpression
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ByteString
parenthesized
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall a. Semigroup a => a -> a -> a
<> ByteString
" :: tsquery")
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. String -> ByteString
escapeQuotedString
instance Semigroup
(Expression grp lat with db params from (null ('PGvararray ty))) where
<> :: Expression grp lat with db params from (null ('PGvararray ty))
-> Expression grp lat with db params from (null ('PGvararray ty))
-> Expression grp lat with db params from (null ('PGvararray ty))
(<>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"||"
instance Semigroup
(Expression grp lat with db params from (null 'PGjsonb)) where
<> :: Expression grp lat with db params from (null 'PGjsonb)
-> Expression grp lat with db params from (null 'PGjsonb)
-> Expression grp lat with db params from (null 'PGjsonb)
(<>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"||"
instance Semigroup
(Expression grp lat with db params from (null 'PGtext)) where
<> :: Expression grp lat with db params from (null 'PGtext)
-> Expression grp lat with db params from (null 'PGtext)
-> Expression grp lat with db params from (null 'PGtext)
(<>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"||"
instance Semigroup
(Expression grp lat with db params from (null 'PGtsvector)) where
<> :: Expression grp lat with db params from (null 'PGtsvector)
-> Expression grp lat with db params from (null 'PGtsvector)
-> Expression grp lat with db params from (null 'PGtsvector)
(<>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"||"
instance Monoid
(Expression grp lat with db params from (null 'PGtext)) where
mempty :: Expression grp lat with db params from (null 'PGtext)
mempty = forall a. IsString a => String -> a
fromString String
""
mappend :: Expression grp lat with db params from (null 'PGtext)
-> Expression grp lat with db params from (null 'PGtext)
-> Expression grp lat with db params from (null 'PGtext)
mappend = forall a. Semigroup a => a -> a -> a
(<>)
instance Monoid
(Expression grp lat with db params from (null 'PGtsvector)) where
mempty :: Expression grp lat with db params from (null 'PGtsvector)
mempty = forall a. IsString a => String -> a
fromString String
""
mappend :: Expression grp lat with db params from (null 'PGtsvector)
-> Expression grp lat with db params from (null 'PGtsvector)
-> Expression grp lat with db params from (null 'PGtsvector)
mappend = forall a. Semigroup a => a -> a -> a
(<>)