hpqtypes-1.5.1.1: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.PQTypes.ToSQL

Synopsis

Documentation

newtype ParamAllocator #

alloca-like producer of PGparam objects.

Constructors

ParamAllocator (forall r. (Ptr PGparam -> IO r) -> IO r) 

class PQFormat t => ToSQL t where #

Class which represents "from Haskell type to SQL (libpqtypes) type" transformation.

Minimal complete definition

toSQL

Associated Types

type PQDest t :: * #

Destination type (used by libpqtypes).

Methods

toSQL :: t -> ParamAllocator -> (Ptr (PQDest t) -> IO r) -> IO r #

Put supplied value into inner PGparam.

Instances

ToSQL Bool # 

Associated Types

type PQDest Bool :: * #

Methods

toSQL :: Bool -> ParamAllocator -> (Ptr (PQDest Bool) -> IO r) -> IO r #

ToSQL Char # 

Associated Types

type PQDest Char :: * #

Methods

toSQL :: Char -> ParamAllocator -> (Ptr (PQDest Char) -> IO r) -> IO r #

ToSQL Double # 

Associated Types

type PQDest Double :: * #

Methods

toSQL :: Double -> ParamAllocator -> (Ptr (PQDest Double) -> IO r) -> IO r #

ToSQL Float # 

Associated Types

type PQDest Float :: * #

Methods

toSQL :: Float -> ParamAllocator -> (Ptr (PQDest Float) -> IO r) -> IO r #

ToSQL Int # 

Associated Types

type PQDest Int :: * #

Methods

toSQL :: Int -> ParamAllocator -> (Ptr (PQDest Int) -> IO r) -> IO r #

ToSQL Int16 # 

Associated Types

type PQDest Int16 :: * #

Methods

toSQL :: Int16 -> ParamAllocator -> (Ptr (PQDest Int16) -> IO r) -> IO r #

ToSQL Int32 # 

Associated Types

type PQDest Int32 :: * #

Methods

toSQL :: Int32 -> ParamAllocator -> (Ptr (PQDest Int32) -> IO r) -> IO r #

ToSQL Int64 # 

Associated Types

type PQDest Int64 :: * #

Methods

toSQL :: Int64 -> ParamAllocator -> (Ptr (PQDest Int64) -> IO r) -> IO r #

ToSQL Word8 # 

Associated Types

type PQDest Word8 :: * #

Methods

toSQL :: Word8 -> ParamAllocator -> (Ptr (PQDest Word8) -> IO r) -> IO r #

ToSQL ByteString # 

Associated Types

type PQDest ByteString :: * #

Methods

toSQL :: ByteString -> ParamAllocator -> (Ptr (PQDest ByteString) -> IO r) -> IO r #

ToSQL ByteString # 

Associated Types

type PQDest ByteString :: * #

Methods

toSQL :: ByteString -> ParamAllocator -> (Ptr (PQDest ByteString) -> IO r) -> IO r #

ToSQL String #

Encodes underlying C string as UTF-8, so if you are working with a different encoding, you should not rely on this instance.

Associated Types

type PQDest String :: * #

Methods

toSQL :: String -> ParamAllocator -> (Ptr (PQDest String) -> IO r) -> IO r #

ToSQL Text #

Encodes underlying C string as UTF-8, so if you are working with a different encoding, you should not rely on this instance.

Associated Types

type PQDest Text :: * #

Methods

toSQL :: Text -> ParamAllocator -> (Ptr (PQDest Text) -> IO r) -> IO r #

ToSQL UTCTime # 

Associated Types

type PQDest UTCTime :: * #

Methods

toSQL :: UTCTime -> ParamAllocator -> (Ptr (PQDest UTCTime) -> IO r) -> IO r #

ToSQL Text #

Encodes underlying C string as UTF-8, so if you are working with a different encoding, you should not rely on this instance.

Associated Types

type PQDest Text :: * #

Methods

toSQL :: Text -> ParamAllocator -> (Ptr (PQDest Text) -> IO r) -> IO r #

ToSQL LocalTime # 

Associated Types

type PQDest LocalTime :: * #

Methods

toSQL :: LocalTime -> ParamAllocator -> (Ptr (PQDest LocalTime) -> IO r) -> IO r #

ToSQL ZonedTime # 

Associated Types

type PQDest ZonedTime :: * #

Methods

toSQL :: ZonedTime -> ParamAllocator -> (Ptr (PQDest ZonedTime) -> IO r) -> IO r #

ToSQL TimeOfDay # 

Associated Types

type PQDest TimeOfDay :: * #

Methods

toSQL :: TimeOfDay -> ParamAllocator -> (Ptr (PQDest TimeOfDay) -> IO r) -> IO r #

ToSQL Day # 

Associated Types

type PQDest Day :: * #

Methods

toSQL :: Day -> ParamAllocator -> (Ptr (PQDest Day) -> IO r) -> IO r #

ToSQL Interval # 

Associated Types

type PQDest Interval :: * #

Methods

toSQL :: Interval -> ParamAllocator -> (Ptr (PQDest Interval) -> IO r) -> IO r #

ToSQL XML # 

Associated Types

type PQDest XML :: * #

Methods

toSQL :: XML -> ParamAllocator -> (Ptr (PQDest XML) -> IO r) -> IO r #

ToSQL t => ToSQL (Maybe t) # 

Associated Types

type PQDest (Maybe t) :: * #

Methods

toSQL :: Maybe t -> ParamAllocator -> (Ptr (PQDest (Maybe t)) -> IO r) -> IO r #

ToSQL (JSONB ByteString) # 

Associated Types

type PQDest (JSONB ByteString) :: * #

Methods

toSQL :: JSONB ByteString -> ParamAllocator -> (Ptr (PQDest (JSONB ByteString)) -> IO r) -> IO r #

ToSQL (JSONB ByteString) # 

Associated Types

type PQDest (JSONB ByteString) :: * #

Methods

toSQL :: JSONB ByteString -> ParamAllocator -> (Ptr (PQDest (JSONB ByteString)) -> IO r) -> IO r #

ToSQL (JSONB Value) # 

Associated Types

type PQDest (JSONB Value) :: * #

Methods

toSQL :: JSONB Value -> ParamAllocator -> (Ptr (PQDest (JSONB Value)) -> IO r) -> IO r #

ToSQL (JSON ByteString) # 

Associated Types

type PQDest (JSON ByteString) :: * #

Methods

toSQL :: JSON ByteString -> ParamAllocator -> (Ptr (PQDest (JSON ByteString)) -> IO r) -> IO r #

ToSQL (JSON ByteString) # 

Associated Types

type PQDest (JSON ByteString) :: * #

Methods

toSQL :: JSON ByteString -> ParamAllocator -> (Ptr (PQDest (JSON ByteString)) -> IO r) -> IO r #

ToSQL (JSON Value) # 

Associated Types

type PQDest (JSON Value) :: * #

Methods

toSQL :: JSON Value -> ParamAllocator -> (Ptr (PQDest (JSON Value)) -> IO r) -> IO r #

CompositeToSQL t => ToSQL (Composite t) # 

Associated Types

type PQDest (Composite t) :: * #

Methods

toSQL :: Composite t -> ParamAllocator -> (Ptr (PQDest (Composite t)) -> IO r) -> IO r #

CompositeToSQL t => ToSQL (CompositeArray2 t) # 

Associated Types

type PQDest (CompositeArray2 t) :: * #

Methods

toSQL :: CompositeArray2 t -> ParamAllocator -> (Ptr (PQDest (CompositeArray2 t)) -> IO r) -> IO r #

ToSQL t => ToSQL (Array2 t) # 

Associated Types

type PQDest (Array2 t) :: * #

Methods

toSQL :: Array2 t -> ParamAllocator -> (Ptr (PQDest (Array2 t)) -> IO r) -> IO r #

CompositeToSQL t => ToSQL (CompositeArray1 t) # 

Associated Types

type PQDest (CompositeArray1 t) :: * #

Methods

toSQL :: CompositeArray1 t -> ParamAllocator -> (Ptr (PQDest (CompositeArray1 t)) -> IO r) -> IO r #

ToSQL t => ToSQL (Array1 t) # 

Associated Types

type PQDest (Array1 t) :: * #

Methods

toSQL :: Array1 t -> ParamAllocator -> (Ptr (PQDest (Array1 t)) -> IO r) -> IO r #

putAsPtr :: Storable t => t -> (Ptr t -> IO r) -> IO r #

Function that abstracts away common elements of most ToSQL instance definitions to make them easier to write and less verbose.