postgresql-typed-0.5.2: PostgreSQL interface with compile-time SQL type checking, optional HDBC backend

Copyright2015 Dylan Simon
Safe HaskellNone
LanguageHaskell98

Database.PostgreSQL.Typed.Dynamic

Description

Automatic (dynamic) marshalling of PostgreSQL values based on Haskell types (not SQL statements). This is intended for direct construction of queries and query data, bypassing the normal SQL type inference.

Synopsis

Documentation

class (PGParameter (PGRepType a) a, PGColumn (PGRepType a) a) => PGRep a Source #

Represents canonical/default PostgreSQL representation for various Haskell types, allowing convenient type-driven marshalling.

Associated Types

type PGRepType a :: Symbol Source #

The PostgreSOL type that this type should be converted to.

Instances

PGRep Bool Source # 

Associated Types

type PGRepType Bool :: Symbol Source #

PGRep Char Source # 

Associated Types

type PGRepType Char :: Symbol Source #

PGRep Double Source # 

Associated Types

type PGRepType Double :: Symbol Source #

PGRep Float Source # 

Associated Types

type PGRepType Float :: Symbol Source #

PGRep Int16 Source # 

Associated Types

type PGRepType Int16 :: Symbol Source #

PGRep Int32 Source # 

Associated Types

type PGRepType Int32 :: Symbol Source #

PGRep Int64 Source # 

Associated Types

type PGRepType Int64 :: Symbol Source #

PGRep Rational Source # 

Associated Types

type PGRepType Rational :: Symbol Source #

PGRep () Source # 

Associated Types

type PGRepType () :: Symbol Source #

PGRep String Source # 

Associated Types

type PGRepType String :: Symbol Source #

PGRep ByteString Source # 

Associated Types

type PGRepType ByteString :: Symbol Source #

PGRep Scientific Source # 

Associated Types

type PGRepType Scientific :: Symbol Source #

PGRep Text Source # 

Associated Types

type PGRepType Text :: Symbol Source #

PGRep UTCTime Source # 

Associated Types

type PGRepType UTCTime :: Symbol Source #

PGRep Value Source # 

Associated Types

type PGRepType Value :: Symbol Source #

PGRep UUID Source # 

Associated Types

type PGRepType UUID :: Symbol Source #

PGRep DiffTime Source # 

Associated Types

type PGRepType DiffTime :: Symbol Source #

PGRep Day Source # 

Associated Types

type PGRepType Day :: Symbol Source #

PGRep TimeOfDay Source # 

Associated Types

type PGRepType TimeOfDay :: Symbol Source #

PGRep LocalTime Source # 

Associated Types

type PGRepType LocalTime :: Symbol Source #

PGRep OID Source # 

Associated Types

type PGRepType OID :: Symbol Source #

PGRep PGName Source # 

Associated Types

type PGRepType PGName :: Symbol Source #

PGRep a => PGRep (Maybe a) Source # 

Associated Types

type PGRepType (Maybe a) :: Symbol Source #

PGRep (TimeOfDay, TimeZone) Source # 

Associated Types

type PGRepType (TimeOfDay, TimeZone) :: Symbol Source #

pgEncodeRep :: PGRep a => a -> PGValue Source #

Encode a value using pgEncodeValue.

pgDecodeRep :: forall a. PGRep a => PGValue -> a Source #

Decode a value using pgDecodeValue.

pgLiteralRep :: PGRep a => a -> ByteString Source #

Produce a literal value for interpolation in a SQL statement using pgLiteral. Using pgSafeLiteral is usually safer as it includes type cast.

pgLiteralString :: PGRep a => a -> String Source #

Produce a raw SQL literal from a value. Using pgSafeLiteral is usually safer when interpolating in a SQL statement.

pgSafeLiteral :: PGRep a => a -> ByteString Source #

Produce a safely type-cast literal value for interpolation in a SQL statement, e.g., "'123'::integer".

pgSafeLiteralString :: PGRep a => a -> String Source #

Identical to unpack . pgSafeLiteral but more efficient.

pgSubstituteLiterals :: String -> ExpQ Source #

Create an expression that literally substitutes each instance of ${expr} for the result of pgSafeLiteral expr, producing a lazy ByteString. This lets you do safe, type-driven literal substitution into SQL fragments without needing a full query, bypassing placeholder inference and any prepared queries, for example when using pgSimpleQuery or pgSimpleQueries_. Unlike most other TH functions, this does not require any database connection.