squeal-postgresql-0.6.0.1: Squeal PostgreSQL Library

Copyright(c) Eitan Chatav 2019
Maintainereitan@morphism.tech
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Squeal.PostgreSQL.Session.Statement

Description

A top-level Statement type wraps a Query or Manipulation together with an EncodeParams and a DecodeRow.

Synopsis

Documentation

data Statement db x y where Source #

A Statement consists of a Manipulation or a Query that can be run in a MonadPQ.

Constructors

Manipulation

Constructor for a data manipulation language statement

Fields

Query

Constructor for a structured query language statement

Fields

Instances
Profunctor (Statement db) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session.Statement

Methods

dimap :: (a -> b) -> (c -> d) -> Statement db b c -> Statement db a d #

lmap :: (a -> b) -> Statement db b c -> Statement db a c #

rmap :: (b -> c) -> Statement db a b -> Statement db a c #

(#.) :: Coercible c b => q b c -> Statement db a b -> Statement db a c #

(.#) :: Coercible b a => Statement db b c -> q a b -> Statement db a c #

Functor (Statement db x) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session.Statement

Methods

fmap :: (a -> b) -> Statement db x a -> Statement db x b #

(<$) :: a -> Statement db x b -> Statement db x a #

RenderSQL (Statement db x y) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session.Statement

Methods

renderSQL :: Statement db x y -> ByteString Source #

query Source #

Arguments

:: (GenericParams db params x xs, GenericRow row y ys) 
=> Query '[] '[] db params row

select, values, ...

-> Statement db x y 

Smart constructor for a structured query language statement

manipulation Source #

Arguments

:: (GenericParams db params x xs, GenericRow row y ys) 
=> Manipulation '[] db params row

insertInto, update, or deleteFrom, ...

-> Statement db x y 

Smart constructor for a data manipulation language statement

type GenericParams db params x xs = (All (OidOfNull db) params, IsProductType x xs, AllZip (ToParam db) params xs) Source #

A GenericParams constraint to ensure that a Haskell type is a product type, all its terms have known Oids, and can be encoded to corresponding Postgres types.

type GenericRow row y ys = (IsRecord y ys, AllZip FromField row ys) Source #

A GenericRow constraint to ensure that a Haskell type is a record type, and all its fields and can be decoded from corresponding Postgres fields.