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

Copyright2015 Dylan Simon
Safe HaskellNone
LanguageHaskell2010

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 # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Bool :: Symbol Source #

PGRep Char Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Char :: Symbol Source #

PGRep Double Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Double :: Symbol Source #

PGRep Float Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Float :: Symbol Source #

PGRep Int16 Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Int16 :: Symbol Source #

PGRep Int32 Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Int32 :: Symbol Source #

PGRep Int64 Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Int64 :: Symbol Source #

PGRep Rational Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Rational :: Symbol Source #

PGRep () Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType () :: Symbol Source #

PGRep String Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType String :: Symbol Source #

PGRep ByteString Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType ByteString :: Symbol Source #

PGRep Scientific Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Scientific :: Symbol Source #

PGRep Text Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Text :: Symbol Source #

PGRep UTCTime Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType UTCTime :: Symbol Source #

PGRep Value Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Value :: Symbol Source #

PGRep UUID Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType UUID :: Symbol Source #

PGRep Day Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType Day :: Symbol Source #

PGRep DiffTime Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType DiffTime :: Symbol Source #

PGRep TimeOfDay Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType TimeOfDay :: Symbol Source #

PGRep LocalTime Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType LocalTime :: Symbol Source #

PGRep OID Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType OID :: Symbol Source #

PGRep PGName Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType PGName :: Symbol Source #

PGRep a => PGRep (Maybe a) Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

Associated Types

type PGRepType (Maybe a) :: Symbol Source #

PGRep (TimeOfDay, TimeZone) Source # 
Instance details

Defined in Database.PostgreSQL.Typed.Dynamic

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.