postgresql-simple-0.6: Mid-Level PostgreSQL client library

Copyright(c) 2011 MailRank Inc.
(c) 2011-2012 Leon P Smith
LicenseBSD3
MaintainerLeon P Smith <leon@melding-monads.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Simple.ToField

Description

The ToField typeclass, for rendering a parameter to a SQL query.

Synopsis

Documentation

data Action Source #

How to render an element when substituting it into a query.

Constructors

Plain Builder

Render without escaping or quoting. Use for non-text types such as numbers, when you are certain that they will not introduce formatting vulnerabilities via use of characters such as spaces or "'".

Escape ByteString

Escape and enclose in quotes before substituting. Use for all text-like types, and anything else that may contain unsafe characters when rendered.

EscapeByteA ByteString

Escape binary data for use as a bytea literal. Include surrounding quotes. This is used by the Binary newtype wrapper.

EscapeIdentifier ByteString

Escape before substituting. Use for all sql identifiers like table, column names, etc. This is used by the Identifier newtype wrapper.

Many [Action]

Concatenate a series of rendering actions.

Instances
Show Action Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Action Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

class ToField a where Source #

A type that may be used as a single parameter to a SQL query.

Minimal complete definition

toField

Methods

toField :: a -> Action Source #

Prepare a value for substitution into a query string.

Instances
ToField Bool Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Bool -> Action Source #

ToField Double Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Float Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Float -> Action Source #

ToField Int Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Int -> Action Source #

ToField Int8 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Int8 -> Action Source #

ToField Int16 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Int16 -> Action Source #

ToField Int32 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Int32 -> Action Source #

ToField Int64 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Int64 -> Action Source #

ToField Integer Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Word Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Word -> Action Source #

ToField Word8 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Word8 -> Action Source #

ToField Word16 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Word32 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Word64 Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField ByteString Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField ByteString Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Scientific Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Text Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Text -> Action Source #

ToField UTCTime Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Value Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Value -> Action Source #

ToField Text Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Text -> Action Source #

ToField Oid Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Oid -> Action Source #

ToField ZonedTime Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField LocalTime Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField TimeOfDay Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField NominalDiffTime Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Day Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Day -> Action Source #

ToField UUID Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: UUID -> Action Source #

ToField Date Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Date -> Action Source #

ToField ZonedTimestamp Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField UTCTimestamp Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField LocalTimestamp Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField QualifiedIdentifier Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Identifier Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Default Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Null Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Null -> Action Source #

ToField Action Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField HStoreMap Source # 
Instance details

Defined in Database.PostgreSQL.Simple.HStore.Implementation

ToField HStoreList Source # 
Instance details

Defined in Database.PostgreSQL.Simple.HStore.Implementation

ToField HStoreBuilder Source # 
Instance details

Defined in Database.PostgreSQL.Simple.HStore.Implementation

ToField [Char] Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: [Char] -> Action Source #

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

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Maybe a -> Action Source #

ToField (CI Text) Source #

citext

Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: CI Text -> Action Source #

ToField (CI Text) Source #

citext

Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: CI Text -> Action Source #

ToField a => ToField (Vector a) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Vector a -> Action Source #

ToRow a => ToField (Values a) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: Values a -> Action Source #

ToField a => ToField (PGArray a) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: PGArray a -> Action Source #

ToField (Binary ByteString) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField (Binary ByteString) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField a => ToField (In [a]) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.ToField

Methods

toField :: In [a] -> Action Source #

ToField (PGRange Double) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Float) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Int) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Int8) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Int16) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Int32) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Int64) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Integer) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Word) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Word8) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Word16) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Word32) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Word64) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Scientific) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange UTCTime) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange ZonedTime) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange LocalTime) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange TimeOfDay) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange NominalDiffTime) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Day) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange Date) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange ZonedTimestamp) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange UTCTimestamp) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

ToField (PGRange LocalTimestamp) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Range

toJSONField :: ToJSON a => a -> Action Source #

Convert a Haskell value to a JSON Value using toJSON and convert that to a field using toField.

This can be used as the default implementation for the toField method for Haskell types that have a JSON representation in PostgreSQL.

inQuotes :: Builder -> Builder Source #

Surround a string with single-quote characters: "'"

This function does not perform any other escaping.