| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Opaleye.Field
Contents
Description
Functions for working directly with Field_s.
Please note that numeric Field_ types are instances of Num, so
 you can use *, /, +, - on them.  To create Field_s, see
 Opaleye.ToFields and Opaleye.SqlTypes.
Field_ used to be called Field_ and for technical reasons
 there are still a few uses of the old name around.  If you see
  then you can understand it as Field_ SqlType, and if you see Field
 SqlType then
 you can understand it as Field_ (Nullability SqlType).FieldNullable SqlType
Field_ will be fully deprecated in version 0.10.
Synopsis
- data Field_ (n :: Nullability) sqlType
 - type Field = Field_ NonNullable
 - type FieldNullable = Field_ 'Nullable
 - data Nullability
 - unsafeCoerceField :: Field_ n a -> Field_ n' b
 - null :: FieldNullable a
 - isNull :: FieldNullable a -> Field PGBool
 - matchNullable :: Field b -> (Field a -> Field b) -> FieldNullable a -> Field b
 - fromNullable :: Field a -> FieldNullable a -> Field a
 - toNullable :: Field a -> FieldNullable a
 - maybeToNullable :: Maybe (Field a) -> FieldNullable a
 
Documentation
data Field_ (n :: Nullability) sqlType Source #
A field of a Select, of type sqlType.  For example a Field
 SqlInt4 is an int4 column and a Field SqlText is a text
 column.
Instances
type Field = Field_ NonNullable Source #
type FieldNullable = Field_ 'Nullable Source #
data Nullability Source #
Constructors
| NonNullable | |
| Nullable | 
Instances
| type A ('H HT :: Arr Type (C Type) Type) ('C '(h, o, N) :: C Type) Source # | |
| type A ('H HT :: Arr Type (C k2) k2) ('C '(h, o, NN) :: C k2) Source # | |
| type A ('H WT :: Arr Type (TC a) Type) ('TC '(t, Opt) :: TC a) Source # | |
| type A ('H HT :: Arr Type (TC a) k2) ('TC '(t, b) :: TC a) Source # | |
| type A ('H NullsT :: Arr Type (TC a) k2) ('TC '(t, b) :: TC a) Source # | |
| type A ('H OT :: Arr Type (TC a) k2) ('TC '(t, b) :: TC a) Source # | |
| type A ('H WT :: Arr Type (TC a) k2) ('TC '(t, Req) :: TC a) Source # | |
| type A ('H NullsT :: Arr Type (C Type) (TYPE LiftedRep)) ('C '(h, o, n) :: C Type) Source # | |
| type A ('H OT :: Arr Type (C Type) (TYPE LiftedRep)) ('C '(h, o, N) :: C Type) Source # | |
| type A ('H OT :: Arr Type (C Type) (TYPE LiftedRep)) ('C '(h, o, NN) :: C Type) Source # | |
Coercing fields
unsafeCoerceField :: Field_ n a -> Field_ n' b Source #
Working with NULL
Instead of working with NULL you are recommended to use
 Opaleye.MaybeFields instead.
null :: FieldNullable a Source #
A NULL of any type
isNull :: FieldNullable a -> Field PGBool Source #
TRUE if the value of the field is NULL, FALSE otherwise.
matchNullable :: Field b -> (Field a -> Field b) -> FieldNullable a -> Field b 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.
fromNullable :: Field a -> FieldNullable a -> Field a Source #
If the FieldNullable a is NULL then return the provided
 Field a otherwise return the underlying Field
 a.
The Opaleye equivalent of fromMaybe and very similar
 to PostgreSQL's COALESCE.
toNullable :: Field a -> FieldNullable a Source #
Treat a field as though it were nullable. This is always safe.
The Opaleye equivalent of Just.
maybeToNullable :: Maybe (Field a) -> FieldNullable a Source #
If the argument is Nothing return NULL otherwise return the
 provided value coerced to a nullable type.