on master help sign in
Document DBEnum
32395d0Ollie Charles
src/Rel8/Type/Enum.hs+5
@@ -91,11 +91,16 @@ instance DBEnum a => DBMax (Enum a)
91instance DBEnum a => DBMin (Enum a)
91instance DBEnum a => DBMin (Enum a)
92
92
93
93
94+-- | @DBEnum@ contains the necessary metadata to describe a PostgreSQL @enum@ type.
94type DBEnum :: Type -> Constraint
95type DBEnum :: Type -> Constraint
95class (DBType a, Enumable a) => DBEnum a where
96class (DBType a, Enumable a) => DBEnum a where
97+ -- | Map Haskell values to the corresponding element of the @enum@ type. The
98+ -- default implementation of this method will use the exact name of the
99+ -- Haskell constructors.
96 enumValue :: a -> String
100 enumValue :: a -> String
97 enumValue = gshow @(Rep a) . from
101 enumValue = gshow @(Rep a) . from
98
102
103+ -- | The name of the PostgreSQL @enum@ type that @a@ maps to.
99 enumTypeName :: String
104 enumTypeName :: String
100
105
101
106