Safe Haskell | None |
---|---|
Language | Haskell2010 |
- restrict :: QueryArr (Column PGBool) ()
- restrictExists :: QueryArr a b -> QueryArr a ()
- restrictNotExists :: QueryArr a b -> QueryArr a ()
- keepWhen :: (a -> Column PGBool) -> QueryArr a a
- (.==) :: Column a -> Column a -> Column PGBool
- (./=) :: Column a -> Column a -> Column PGBool
- (.===) :: Default EqPP columns columns => columns -> columns -> Column PGBool
- (./==) :: Default EqPP columns columns => columns -> columns -> Column PGBool
- (.>) :: PGOrd a => Column a -> Column a -> Column PGBool
- (.<) :: PGOrd a => Column a -> Column a -> Column PGBool
- (.<=) :: PGOrd a => Column a -> Column a -> Column PGBool
- (.>=) :: PGOrd a => Column a -> Column a -> Column PGBool
- quot_ :: PGIntegral a => Column a -> Column a -> Column a
- rem_ :: PGIntegral a => Column a -> Column a -> Column a
- case_ :: [(Column PGBool, Column a)] -> Column a -> Column a
- ifThenElse :: Column PGBool -> Column a -> Column a -> Column a
- ifThenElseMany :: Default IfPP columns columns => Column PGBool -> columns -> columns -> columns
- (.||) :: Column PGBool -> Column PGBool -> Column PGBool
- (.&&) :: Column PGBool -> Column PGBool -> Column PGBool
- not :: Column PGBool -> Column PGBool
- ors :: Foldable f => f (Column PGBool) -> Column PGBool
- (.++) :: Column PGText -> Column PGText -> Column PGText
- lower :: Column PGText -> Column PGText
- upper :: Column PGText -> Column PGText
- like :: Column PGText -> Column PGText -> Column PGBool
- ilike :: Column PGText -> Column PGText -> Column PGBool
- charLength :: PGString a => Column a -> Column Int
- in_ :: (Functor f, Foldable f) => f (Column a) -> Column a -> Column PGBool
- inQuery :: Default EqPP columns columns => columns -> Query columns -> Query (Column PGBool)
- class PGIsJson a
- class PGJsonIndex a
- (.->) :: (PGIsJson a, PGJsonIndex k) => Column (Nullable a) -> Column k -> Column (Nullable a)
- (.->>) :: (PGIsJson a, PGJsonIndex k) => Column (Nullable a) -> Column k -> Column (Nullable PGText)
- (.#>) :: PGIsJson a => Column (Nullable a) -> Column (PGArray PGText) -> Column (Nullable a)
- (.#>>) :: PGIsJson a => Column (Nullable a) -> Column (PGArray PGText) -> Column (Nullable PGText)
- (.@>) :: Column PGJsonb -> Column PGJsonb -> Column PGBool
- (.<@) :: Column PGJsonb -> Column PGJsonb -> Column PGBool
- (.?) :: Column PGJsonb -> Column PGText -> Column PGBool
- (.?|) :: Column PGJsonb -> Column (PGArray PGText) -> Column PGBool
- (.?&) :: Column PGJsonb -> Column (PGArray PGText) -> Column PGBool
- emptyArray :: IsSqlType a => Column (PGArray a)
- arrayPrepend :: Column a -> Column (PGArray a) -> Column (PGArray a)
- singletonArray :: IsSqlType a => Column a -> Column (PGArray a)
- index :: PGIntegral n => Column (PGArray a) -> Column n -> Column (Nullable a)
- overlap :: Column (PGRange a) -> Column (PGRange a) -> Column PGBool
- (.<<) :: Column (PGRange a) -> Column (PGRange a) -> Column PGBool
- (.>>) :: Column (PGRange a) -> Column (PGRange a) -> Column PGBool
- (.&<) :: Column (PGRange a) -> Column (PGRange a) -> Column PGBool
- (.&>) :: Column (PGRange a) -> Column (PGRange a) -> Column PGBool
- (.-|-) :: Column (PGRange a) -> Column (PGRange a) -> Column PGBool
- timestamptzAtTimeZone :: Column PGTimestamptz -> Column PGText -> Column PGTimestamp
- doubleOfInt :: Column PGInt4 -> Column PGFloat8
- exists :: QueryArr a b -> QueryArr a ()
- notExists :: QueryArr a b -> QueryArr a ()
Restriction operators
restrict :: QueryArr (Column PGBool) () Source #
Keep only the rows of a query satisfying a given condition, using
an SQL WHERE
clause.
You would typically use restrict
if you want to write your query
using Arrow
notation. If you want to use a "point free" style
then keepWhen
will suit you better.
(If you are familiar with MonadPlus
or
Alternative
it may help you to know that
restrict
corresponds to the guard
function.)
restrictExists :: QueryArr a b -> QueryArr a () Source #
Add a WHERE EXISTS
clause to the current query.
restrictNotExists :: QueryArr a b -> QueryArr a () Source #
Add a WHERE NOT EXISTS
clause to the current query.
Equality operators
(.===) :: Default EqPP columns columns => columns -> columns -> Column PGBool infix 4 Source #
A polymorphic equality operator that works for all types that you
have run makeAdaptorAndInstance
on. This may be unified with
.==
in a future version.
(./==) :: Default EqPP columns columns => columns -> columns -> Column PGBool infix 4 Source #
A polymorphic inequality operator that works for all types that
you have run makeAdaptorAndInstance
on. This may be unified with
./=
in a future version.
Comparison operators
Numerical operators
quot_ :: PGIntegral a => Column a -> Column a -> Column a Source #
Integral division, named after quot
. It maps to the
/
operator in Postgres.
rem_ :: PGIntegral a => Column a -> Column a -> Column a Source #
The remainder of integral division, named after rem
.
It maps to MOD
(%
) in Postgres, confusingly described as
"modulo (remainder)".
Conditional operators
case_ :: [(Column PGBool, Column a)] -> Column a -> Column a Source #
Select the first case for which the condition is true.
ifThenElse :: Column PGBool -> Column a -> Column a -> Column a Source #
Monomorphic if/then/else.
This may be replaced by ifThenElseMany
in a future version.
ifThenElseMany :: Default IfPP columns columns => Column PGBool -> columns -> columns -> columns Source #
Polymorphic if/then/else.
Logical operators
ors :: Foldable f => f (Column PGBool) -> Column PGBool Source #
True when any element of the container is true
Text operators
Containment operators
inQuery :: Default EqPP columns columns => columns -> Query columns -> Query (Column PGBool) Source #
True if the first argument occurs amongst the rows of the second, false otherwise.
This operation is equivalent to Postgres's IN
operator but, for
expediency, is currently implemented using a LEFT JOIN
. Please
file a bug if this causes any issues in practice.
JSON operators
class PGJsonIndex a Source #
Class of Postgres types that can be used to index json values.
Warning: making additional instances of this class can lead to broken code!
Get JSON object field by key.
:: (PGIsJson a, PGJsonIndex k) | |
=> Column (Nullable a) | |
-> Column k | key or index |
-> Column (Nullable PGText) |
Get JSON object field as text.
Get JSON object at specified path.
Get JSON object at specified path as text.
(.@>) :: Column PGJsonb -> Column PGJsonb -> Column PGBool infix 4 Source #
Does the left JSON value contain within it the right value?
(.<@) :: Column PGJsonb -> Column PGJsonb -> Column PGBool infix 4 Source #
Is the left JSON value contained within the right value?
(.?) :: Column PGJsonb -> Column PGText -> Column PGBool infix 4 Source #
Does the key/element string exist within the JSON value?
(.?|) :: Column PGJsonb -> Column (PGArray PGText) -> Column PGBool infix 4 Source #
Do any of these key/element strings exist?
(.?&) :: Column PGJsonb -> Column (PGArray PGText) -> Column PGBool infix 4 Source #
Do all of these key/element strings exist?
PGArray operators
Range operators
Other operators
Deprecated
doubleOfInt :: Column PGInt4 -> Column PGFloat8 Source #
Deprecated: Use unsafeCast
instead. Will be removed in version 0.7.