postgresql-orm-0.5.0: An ORM (Object Relational Mapping) and migrations DSL for PostgreSQL.

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.ORM.SqlType

Synopsis

Documentation

class (ToField a, FromField a) => SqlType a where Source #

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.

Minimal complete definition

sqlBaseType

Methods

sqlBaseType :: a -> ByteString Source #

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 Maybe a will be converted (where Nothing corresponds to the SQL value null).

sqlType :: a -> ByteString Source #

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.

Instances

SqlType Bool Source # 
SqlType Double Source # 
SqlType Float Source # 
SqlType Int16 Source # 
SqlType Int32 Source # 
SqlType Int64 Source # 
SqlType ByteString Source # 
SqlType ByteString Source # 
SqlType String Source # 
SqlType Text Source # 
SqlType UTCTime Source # 
SqlType Text Source # 
SqlType Oid Source # 
SqlType LocalTimestamp Source # 
SqlType UTCTimestamp Source # 
SqlType ZonedTimestamp Source # 
SqlType Date Source # 
SqlType ZonedTime Source # 
SqlType LocalTime Source # 
SqlType TimeOfDay Source # 
SqlType Day Source # 
SqlType DBKey Source # 
SqlType a => SqlType (Maybe a) Source # 
SqlType (Binary ByteString) Source # 
SqlType (Binary ByteString) Source # 
(Typeable * a, SqlType a) => SqlType (Vector a) Source # 
Model a => SqlType (DBRefUnique a) Source # 
Model a => SqlType (DBRef a) Source # 

getTypeOid :: Connection -> ByteString -> IO Oid Source #

Retreive the Oid corresponding to a type. You can subsequently use the Oid to call getTypeInfo for more information on the type.