Safe Haskell | None |
---|
- class (ToField a, FromField a) => SqlType a where
- sqlBaseType :: a -> ByteString
- sqlType :: a -> ByteString
- getTypeOid :: Connection -> ByteString -> IO Oid
Documentation
class (ToField a, FromField a) => SqlType a whereSource
The class of Haskell types that can be converted to and from a
particular SQL type. For most instances, you only need to define
sqlBaseType
.
sqlBaseType :: a -> ByteStringSource
The name of the SQL type corresponding to Haskell type a
,
when a value of a
can be null. This is the SQL type to and
from which a
will be converted (where Maybe
aNothing
corresponds to the SQL value null).
sqlType :: a -> ByteStringSource
The name of the SQL type corresponding to Haskell type a
,
when a
is not wrapped in Maybe
and hence cannot be null. If
sqlType
is unspecified, the default is to append "NOT NULL
"
to sqlBaseType
.
getTypeOid :: Connection -> ByteString -> IO OidSource