Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Null values and null handling functions
Synopsis
- null_ :: Expr (Null ty)
- notNull :: NotNull ty :--> Null ty
- coalesce :: FunctionVar (Null ty) (NotNull ty) (NotNull ty)
- fromNull :: Expression outer commons grp schemas params from (NotNull ty) -> Expression outer commons grp schemas params from (Null ty) -> Expression outer commons grp schemas params from (NotNull ty)
- isNull :: Null ty :--> null PGbool
- isNotNull :: Null ty :--> null PGbool
- matchNull :: Expression outer commons grp schemas params from nullty -> (Expression outer commons grp schemas params from (NotNull ty) -> Expression outer commons grp schemas params from nullty) -> Expression outer commons grp schemas params from (Null ty) -> Expression outer commons grp schemas params from nullty
- nullIf :: FunctionN '[NotNull ty, NotNull ty] (Null ty)
Documentation
coalesce :: FunctionVar (Null ty) (NotNull ty) (NotNull ty) Source #
return the leftmost value which is not NULL
>>>
printSQL $ coalesce [null_, true] false
COALESCE(NULL, TRUE, FALSE)
:: Expression outer commons grp schemas params from (NotNull ty) | what to convert |
-> Expression outer commons grp schemas params from (Null ty) | |
-> Expression outer commons grp schemas params from (NotNull ty) |
analagous to fromMaybe
using COALESCE
>>>
printSQL $ fromNull true null_
COALESCE(NULL, TRUE)
:: Expression outer commons grp schemas params from nullty | what to convert |
-> (Expression outer commons grp schemas params from (NotNull ty) -> Expression outer commons grp schemas params from nullty) | function to perform when |
-> Expression outer commons grp schemas params from (Null ty) | |
-> Expression outer commons grp schemas params from nullty |
analagous to maybe
using IS NULL
>>>
printSQL $ matchNull true not_ null_
CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END