| Copyright | 2015 Dylan Simon |
|---|---|
| Safe Haskell | None |
| Language | Haskell98 |
Database.PostgreSQL.Typed.Enum
Description
Support for PostgreSQL enums.
Documentation
Arguments
| :: String | PostgreSQL enum type name |
| -> String | Haskell type to create |
| -> (String -> String) | How to generate constructor names from enum values, e.g. |
| -> DecsQ |
Create a new enum type corresponding to the given PostgreSQL enum type.
For example, if you have CREATE TYPE foo AS ENUM ('abc', 'DEF');, then
makePGEnum "foo" "Foo" ("Foo_"++) will be equivalent to:
data Foo = Foo_abc | Foo_DEF deriving (Eq, Ord, Enum, Bounded) instance PGType Foo where ... registerPGType "foo" (ConT ''Foo)
Requires language extensions: TemplateHaskell, FlexibleInstances, MultiParamTypeClasses, DataKinds