hpqtypes-1.5.1.1: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.PQTypes.ToSQL

Synopsis

Documentation

newtype ParamAllocator Source #

alloca-like producer of PGparam objects.

Constructors

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

class PQFormat t => ToSQL t where Source #

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

Minimal complete definition

toSQL

Associated Types

type PQDest t :: * Source #

Destination type (used by libpqtypes).

Methods

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

Put supplied value into inner PGparam.

Instances

ToSQL Bool Source # 

Associated Types

type PQDest Bool :: * Source #

Methods

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

ToSQL Char Source # 

Associated Types

type PQDest Char :: * Source #

Methods

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

ToSQL Double Source # 

Associated Types

type PQDest Double :: * Source #

Methods

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

ToSQL Float Source # 

Associated Types

type PQDest Float :: * Source #

Methods

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

ToSQL Int Source # 

Associated Types

type PQDest Int :: * Source #

Methods

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

ToSQL Int16 Source # 

Associated Types

type PQDest Int16 :: * Source #

Methods

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

ToSQL Int32 Source # 

Associated Types

type PQDest Int32 :: * Source #

Methods

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

ToSQL Int64 Source # 

Associated Types

type PQDest Int64 :: * Source #

Methods

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

ToSQL Word8 Source # 

Associated Types

type PQDest Word8 :: * Source #

Methods

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

ToSQL ByteString Source # 

Associated Types

type PQDest ByteString :: * Source #

ToSQL ByteString Source # 

Associated Types

type PQDest ByteString :: * Source #

ToSQL String Source #

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 :: * Source #

Methods

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

ToSQL Text Source #

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 :: * Source #

Methods

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

ToSQL UTCTime Source # 

Associated Types

type PQDest UTCTime :: * Source #

Methods

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

ToSQL Text Source #

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 :: * Source #

Methods

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

ToSQL LocalTime Source # 

Associated Types

type PQDest LocalTime :: * Source #

Methods

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

ToSQL ZonedTime Source # 

Associated Types

type PQDest ZonedTime :: * Source #

Methods

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

ToSQL TimeOfDay Source # 

Associated Types

type PQDest TimeOfDay :: * Source #

Methods

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

ToSQL Day Source # 

Associated Types

type PQDest Day :: * Source #

Methods

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

ToSQL Interval Source # 

Associated Types

type PQDest Interval :: * Source #

Methods

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

ToSQL XML Source # 

Associated Types

type PQDest XML :: * Source #

Methods

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

ToSQL t => ToSQL (Maybe t) Source # 

Associated Types

type PQDest (Maybe t) :: * Source #

Methods

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

ToSQL (JSONB ByteString) Source # 

Associated Types

type PQDest (JSONB ByteString) :: * Source #

ToSQL (JSONB ByteString) Source # 

Associated Types

type PQDest (JSONB ByteString) :: * Source #

ToSQL (JSONB Value) Source # 

Associated Types

type PQDest (JSONB Value) :: * Source #

Methods

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

ToSQL (JSON ByteString) Source # 

Associated Types

type PQDest (JSON ByteString) :: * Source #

ToSQL (JSON ByteString) Source # 

Associated Types

type PQDest (JSON ByteString) :: * Source #

ToSQL (JSON Value) Source # 

Associated Types

type PQDest (JSON Value) :: * Source #

Methods

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

CompositeToSQL t => ToSQL (Composite t) Source # 

Associated Types

type PQDest (Composite t) :: * Source #

Methods

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

CompositeToSQL t => ToSQL (CompositeArray2 t) Source # 

Associated Types

type PQDest (CompositeArray2 t) :: * Source #

ToSQL t => ToSQL (Array2 t) Source # 

Associated Types

type PQDest (Array2 t) :: * Source #

Methods

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

CompositeToSQL t => ToSQL (CompositeArray1 t) Source # 

Associated Types

type PQDest (CompositeArray1 t) :: * Source #

ToSQL t => ToSQL (Array1 t) Source # 

Associated Types

type PQDest (Array1 t) :: * Source #

Methods

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

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

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