rel8-internal
Safe HaskellNone
LanguageHaskell2010

Rel8.Internal.Type.Enum

Synopsis

Documentation

newtype Enum a Source #

A deriving-via helper type for column types that store an "enum" type (in Haskell terms, a sum type where all constructors are nullary) using a Postgres enum type.

Note that this should map to a specific type in your database's schema (explicitly created with CREATE TYPE ... AS ENUM). Use DBEnum to specify the name of this Postgres type and the names of the individual values. If left unspecified, the names of the values of the Postgres enum are assumed to match exactly exactly the names of the constructors of the Haskell type (up to and including case sensitivity).

Constructors

Enum a 

Instances

Instances details
DBEnum a => DBType (Enum a) Source # 
Instance details

Defined in Rel8.Internal.Type.Enum

DBEnum a => DBEq (Enum a) Source # 
Instance details

Defined in Rel8.Internal.Type.Enum

DBEnum a => DBMax (Enum a) Source # 
Instance details

Defined in Rel8.Internal.Type.Enum

DBEnum a => DBMin (Enum a) Source # 
Instance details

Defined in Rel8.Internal.Type.Enum

DBEnum a => DBOrd (Enum a) Source # 
Instance details

Defined in Rel8.Internal.Type.Enum

class DBType a => DBEnum a where Source #

DBEnum contains the necessary metadata to describe a PostgreSQL enum type.

Minimal complete definition

enumTypeName

Methods

enumValue :: a -> String Source #

Map Haskell values to the corresponding element of the enum type. The default implementation of this method will use the exact name of the Haskell constructors.

default enumValue :: Enumable a => a -> String Source #

enumTypeName :: QualifiedName Source #

The name of the PostgreSQL enum type that a maps to.

enumerate :: [a] Source #

List of all possible values of the enum type.

default enumerate :: Enumable a => [a] Source #

class (Generic a, GEnumable (Rep a)) => Enumable a Source #

Types that are sum types, where each constructor is unary (that is, has no fields).

Instances

Instances details
(Generic a, GEnumable (Rep a)) => Enumable a Source # 
Instance details

Defined in Rel8.Internal.Type.Enum