opaleye-0.5.0.0: An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone
LanguageHaskell98

Opaleye.Column

Synopsis

Documentation

null :: Column (Nullable a) Source

A NULL of any type

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 the maybe function.

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 the fromMaybe function

toNullable :: Column a -> Column (Nullable a) Source

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.

data Column a Source

Numeric Column types are instances of Num, so you can use *, /, +, - on them.

Instances

Default Constant Bool (Column PGBool) 
Default Constant Double (Column PGFloat8) 
Default Constant Int (Column PGInt4) 
Default Constant Int32 (Column PGInt4) 
Default Constant Int64 (Column PGInt8) 
Default Constant String (Column PGText) 
Default Constant ByteString (Column PGJsonb) 
Default Constant ByteString (Column PGJson) 
Default Constant ByteString (Column PGBytea) 
Default Constant ByteString (Column PGJsonb) 
Default Constant ByteString (Column PGJson) 
Default Constant ByteString (Column PGBytea) 
Default Constant Text (Column PGText) 
Default Constant UTCTime (Column PGTimestamptz) 
Default Constant Value (Column PGJsonb) 
Default Constant Value (Column PGJson) 
Default Constant Text (Column PGText) 
Default Constant LocalTime (Column PGTimestamp) 
Default Constant TimeOfDay (Column PGTime) 
Default Constant Day (Column PGDate) 
Default Constant UUID (Column PGUuid) 
Default ViewColumnMaker String (Column a) 
QueryRunnerColumnDefault a b => Default QueryRunner (Column a) b 
Default EqPP (Column a) (Column a) 
(Default Constant a (Column b), IsSqlType b) => Default Constant [a] (Column (PGArray b)) 
Default Constant haskell (Column sql) => Default Constant (Maybe haskell) (Maybe (Column sql)) 
Default Constant haskell (Column sql) => Default Constant (Maybe haskell) (Column (Nullable sql)) 
Default Constant (CI Text) (Column PGCitext) 
Default Constant (CI Text) (Column PGCitext) 
Default Unpackspec (Column a) (Column a) 
Default Binaryspec (Column a) (Column a) 
Default Valuesspec (Column a) (Column a) 
Default NullMaker (Column a) (Column (Nullable a)) 
Default NullMaker (Column (Nullable a)) (Column (Nullable a)) 
Default ColumnMaker (Column a) (Column a) 
Default Distinctspec (Column a) (Column a) 
(PGNum a, PGFractional a) => Fractional (Column a) Source 
PGNum a => Num (Column a) Source 
Show (Column a) Source 
PGString a => IsString (Column a) Source 

unsafeCast :: String -> Column a -> Column b Source

Cast a column to any other type. This is safe for some conversions such as uuid to text.

unsafeCoerce :: Column a -> Column b Source

Deprecated: Use unsafeCoerceColumn instead