opaleye-0.6.7000.0: An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone
LanguageHaskell2010

Opaleye.Field

Synopsis

Documentation

type family Field_ (a :: Nullability) b Source #

Instances

data Nullability Source #

Constructors

NonNullable 
Nullable 

Instances

type A * (TC a) k2 (H * (TC a) k2 NullsT) (TC a ((,) (a, a, Nullability) Optionality t b)) Source # 
type A * (TC a) k2 (H * (TC a) k2 NullsT) (TC a ((,) (a, a, Nullability) Optionality t b)) = A * (C a) k2 (H * (C a) k2 NullsT) (C a t)
type A * (TC a) k2 (H * (TC a) k2 WT) (TC a ((,) (a, a, Nullability) Optionality t Req)) Source # 
type A * (TC a) k2 (H * (TC a) k2 WT) (TC a ((,) (a, a, Nullability) Optionality t Req)) = A * (C a) k2 (H * (C a) k2 OT) (C a t)
type A * (TC a) k2 (H * (TC a) k2 OT) (TC a ((,) (a, a, Nullability) Optionality t b)) Source # 
type A * (TC a) k2 (H * (TC a) k2 OT) (TC a ((,) (a, a, Nullability) Optionality t b)) = A * (C a) k2 (H * (C a) k2 OT) (C a t)
type A * (TC a) k2 (H * (TC a) k2 HT) (TC a ((,) (a, a, Nullability) Optionality t b)) Source # 
type A * (TC a) k2 (H * (TC a) k2 HT) (TC a ((,) (a, a, Nullability) Optionality t b)) = A * (C a) k2 (H * (C a) k2 HT) (C a t)
type A * (C k2) k2 (H * (C k2) k2 HT) (C k2 ((,,) k2 k2 Nullability h o NN)) Source # 
type A * (C k2) k2 (H * (C k2) k2 HT) (C k2 ((,,) k2 k2 Nullability h o NN)) = h
type A * (TC a) * (H * (TC a) * WT) (TC a ((,) (a, a, Nullability) Optionality t Opt)) Source # 
type A * (TC a) * (H * (TC a) * WT) (TC a ((,) (a, a, Nullability) Optionality t Opt)) = Maybe (A * (C a) * (H * (C a) * OT) (C a t))
type A * (C *) * (H * (C *) * NullsT) (C * ((,,) * * Nullability h o NN)) Source # 
type A * (C *) * (H * (C *) * NullsT) (C * ((,,) * * Nullability h o NN)) = Column (Nullable o)
type A * (C *) * (H * (C *) * OT) (C * ((,,) * * Nullability h o N)) Source # 
type A * (C *) * (H * (C *) * OT) (C * ((,,) * * Nullability h o N)) = Column (Nullable o)
type A * (C *) * (H * (C *) * OT) (C * ((,,) * * Nullability h o NN)) Source # 
type A * (C *) * (H * (C *) * OT) (C * ((,,) * * Nullability h o NN)) = Column o
type A * (C *) * (H * (C *) * HT) (C * ((,,) * * Nullability h o N)) Source # 
type A * (C *) * (H * (C *) * HT) (C * ((,,) * * Nullability h o N)) = Maybe h

null :: FieldNullable a Source #

A NULL of any type

isNull :: FieldNullable a -> Field PGBool Source #

TRUE if the value of the column is NULL, FALSE otherwise.

matchNullable Source #

If the Field 'Nullable a is NULL then return the Field 'NonNullable b otherwise map the underlying Field 'Nullable a using the provided function.

The Opaleye equivalent of maybe.

Will be generalized to Field_ n b in a later version.

fromNullable Source #

Arguments

:: Field_ NonNullable a 
-> Field_ Nullable a 
-> Field_ NonNullable a 

If the Field 'Nullable a is NULL then return the provided Field 'NonNullable a otherwise return the underlying Field 'NonNullable a.

The Opaleye equivalent of fromMaybe and very similar to PostgreSQL's COALESCE.

Will be generalized to Field_ n a in a later version.

toNullable :: Field_ NonNullable a -> Field_ Nullable a Source #

Treat a field as though it were nullable. This is always safe.

The Opaleye equivalent of Just.

Will be generalized to Field_ n a in a later version.

maybeToNullable :: Maybe (Field_ NonNullable a) -> Field_ Nullable a Source #

If the argument is Nothing return NULL otherwise return the provided value coerced to a nullable type.

Will be generalized to Maybe (Field_ n a) in a later version.