| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Opaleye.Constant
Documentation
constant :: Default Constant haskells columns => haskells -> columns Source #
constant provides a convenient typeclass wrapper around the
Column creation functions in Opaleye.PGTypes. Besides
convenience it doesn't provide any additional functionality.
It can be used with functions like runInsert
to insert custom Haskell types into the database.
The following is an example of a function for inserting custom types.
customInsert
:: ( Default Constant haskells columns )
=> Connection
-> Table columns columns'
-> haskells
-> IO Int64
customInsert conn table haskells = runInsert conn table $ constant haskells
In order to use this function with your custom types, you need to define an
instance of Default Constant for your custom types.
newtype Constant haskells columns Source #
Constructors
| Constant | |
Fields
| |
Instances