postgresql-simple-0.6.5: Mid-Level PostgreSQL client library
Copyright (c) 2011 MailRank Inc.
(c) 2011-2012 Leon P Smith
License BSD3
Maintainer Leon P Smith <leon@melding-monads.com>
Stability experimental
Safe Haskell None
Language Haskell2010

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.

class ToField a where Source #

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

Methods

toField :: a -> Action Source #

Prepare a value for substitution into a query string.

Instances

Instances details
ToField Bool Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Double Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Float Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Int Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Int8 Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Int16 Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Int32 Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Int64 Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Integer Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Word Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Word8 Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

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

Defined in Database.PostgreSQL.Simple.ToField

ToField Text Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Value Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Text Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Oid Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

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 CalendarDiffTime 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

ToField UUID Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField Date Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

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

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

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

Defined in Database.PostgreSQL.Simple.ToField

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

Defined in Database.PostgreSQL.Simple.ToField

ToField ( CI Text ) Source #

citext

Instance details

Defined in Database.PostgreSQL.Simple.ToField

ToField ( CI Text ) Source #

citext

Instance details

Defined in Database.PostgreSQL.Simple.ToField

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

Defined in Database.PostgreSQL.Simple.ToField

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

Defined in Database.PostgreSQL.Simple.ToField

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

Defined in Database.PostgreSQL.Simple.ToField

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

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

ToJSON a => ToField ( Aeson a) Source #
Instance details

Defined in Database.PostgreSQL.Simple.Newtypes

ToField a => ToField ( Const a b) Source #
Instance details

Defined in Database.PostgreSQL.Simple.ToField

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

Convert a Haskell value to JSON using toEncoding .

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.