Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Column pgType
- data Nullable a
- null :: Column (Nullable a)
- isNull :: Column (Nullable a) -> Column PGBool
- matchNullable :: Column b -> (Column a -> Column b) -> Column (Nullable a) -> Column b
- fromNullable :: Column a -> Column (Nullable a) -> Column a
- toNullable :: Column a -> Column (Nullable a)
- maybeToNullable :: Maybe (Column a) -> Column (Nullable a)
- unsafeCast :: String -> Column a -> Column b
- unsafeCoerce :: Column a -> Column b
- unsafeCoerceColumn :: Column a -> Column b
- unsafeCompositeField :: Column a -> String -> Column b
- null :: Column (Nullable a)
- isNull :: Column (Nullable a) -> Column PGBool
- matchNullable :: Column b -> (Column a -> Column b) -> Column (Nullable a) -> Column b
- fromNullable :: Column a -> Column (Nullable a) -> Column a
- toNullable :: Column a -> Column (Nullable a)
- maybeToNullable :: Maybe (Column a) -> Column (Nullable a)
Column
A column of a Query
, of type pgType
. For example Column
PGInt4
is an int4
column and a Column
PGText
is a text
column.
Working with NULL
Only used within a Column
, to indicate that it can be NULL
.
For example, a Column
(Nullable
PGText
) can be NULL
but a
Column
PGText
cannot.
Default Constant haskell (Column sql) => Default Constant (Maybe haskell) (Column (Nullable sql)) # | |
Default NullMaker (Column a) (Column (Nullable a)) # | |
Default NullMaker (Column (Nullable a)) (Column (Nullable a)) # | |
IsSqlType a => IsSqlType (Nullable a) Source # | |
PGOrd a => PGOrd (Nullable a) Source # | |
QueryRunnerColumnDefault a b => QueryRunnerColumnDefault (Nullable a) (Maybe b) Source # | |
isNull :: Column (Nullable a) -> Column PGBool Source #
TRUE
if the value of the column is NULL
, FALSE
otherwise.
matchNullable :: Column b -> (Column a -> Column b) -> Column (Nullable a) -> Column b Source #
If the Column (Nullable a)
is NULL then return the Column b
otherwise map the underlying Column a
using the provided
function.
The Opaleye equivalent of maybe
.
fromNullable :: Column a -> Column (Nullable a) -> Column a Source #
If the Column (Nullable a)
is NULL then return the provided
Column a
otherwise return the underlying Column a
.
The Opaleye equivalent of fromMaybe
.
toNullable :: Column a -> Column (Nullable a) Source #
Treat a column as though it were nullable. This is always safe.
The Opaleye equivalent of Just
.
maybeToNullable :: Maybe (Column a) -> Column (Nullable a) Source #
If the argument is Nothing
return NULL otherwise return the
provided value coerced to a nullable type.
Unsafe operations
unsafeCast :: String -> Column a -> Column b Source #
Cast a column to any other type. Implements Postgres's ::
or
CAST( ... AS ... )
operations. This is safe for some
conversions, such as uuid to text.
unsafeCoerce :: Column a -> Column b Source #
Deprecated: Will be removed in version 0.6. Use unsafeCoerceColumn instead.
unsafeCoerceColumn :: Column a -> Column b Source #
Treat a Column
as though it were of a different type. If such
a treatment is not valid then Postgres may fail with an error at
SQL run time.
Entire module
isNull :: Column (Nullable a) -> Column PGBool Source #
TRUE
if the value of the column is NULL
, FALSE
otherwise.
matchNullable :: Column b -> (Column a -> Column b) -> Column (Nullable a) -> Column b Source #
If the Column (Nullable a)
is NULL then return the Column b
otherwise map the underlying Column a
using the provided
function.
The Opaleye equivalent of maybe
.
fromNullable :: Column a -> Column (Nullable a) -> Column a Source #
If the Column (Nullable a)
is NULL then return the provided
Column a
otherwise return the underlying Column a
.
The Opaleye equivalent of fromMaybe
.