postgresql-simple-bind-0.3.0.0: FFI-like bindings for PostgreSQL stored functions

Copyright(c) 2016 Al Zohali
LicenseBSD3
MaintainerAl Zohali <zohl@fmap.me>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Simple.Bind

Description

Description

postgresql-simple-bind is an extension for postgresql-simple library that faciliates and automates bindings creation. This is especially useful in a design pattern where an application communicates with a database via API hiding the internal structure of the latter.

Synopsis

Documentation

bindFunction :: PostgresBindOptions -> Text -> Q [Dec] Source #

Function that constructs binding for PostgreSQL stored function by it's signature.

data PostgresBindOptions Source #

Options that specify how to construct the function binding.

Constructors

PostgresBindOptions 

Fields

data ReturnType Source #

How to interpret results of function execution.

Constructors

AsRow 
AsField 

data PostgresBindException Source #

The exception is thrown when something goes wrong with this package.

Constructors

ParserFailed String

Thrown when parser fails to process a function declaration. Arguments of the constructor: error message from the parser.

DefaultValueNotFound String

Thrown when Argument expected to have default value while it doesn't. Actually this should never happen, but we all know...

type family PostgresType (a :: Symbol) Source #

Mapping from PostgreSQL types to Haskell types.

Instances

type PostgresType "bigint" Source # 
type PostgresType "bigint" = Int
type PostgresType "character varying" Source # 
type PostgresType "character varying" = Text
type PostgresType "timestamp with time zone" Source # 
type PostgresType "timestamp with time zone" = UTCTime
type PostgresType "timestamptz" Source # 
type PostgresType "timestamptz" = UTCTime
type PostgresType "varchar" Source # 
type PostgresType "varchar" = Text
type PostgresType "void" Source # 
type PostgresType "void" = ()

data PGFunction Source #

Representation of a PostrgeSQL function signature (schema, name, arguments, result).

data PGArgument Source #

Representation of a function's argument (name, type, is optional).

data PGColumn Source #

Representation of a resultant's column (name, type).

Constructors

PGColumn String String 

data PGResult Source #

Representation of a function's return value.