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

Copyright | (c) 2012 Leon P Smith
License | BSD3
Maintainer | Leon P Smith <leon@melding-monads.com>
Stability | experimental
Safe Haskell | Safe-Inferred
Language | Haskell2010

Database.PostgreSQL.Simple.Arrays

Description

A Postgres array parser and pretty-printer.

Synopsis

- arrayFormat :: Char -> Parser ArrayFormat
- data ArrayFormat
  - = Array [ArrayFormat]
  - | Plain ByteString
  - | Quoted ByteString
- array :: Char -> Parser [ArrayFormat]
- quoted :: Parser ByteString
- plain :: Char -> Parser ByteString
- fmt :: Char -> ArrayFormat -> ByteString
- delimit :: Char -> [ArrayFormat] -> ByteString
- fmt' :: Bool -> Char -> ArrayFormat -> ByteString
- esc :: ByteString -> ByteString

# Documentation

arrayFormat :: Char -> Parser ArrayFormat Source #

Parse one of three primitive field formats: array, quoted and plain.

data ArrayFormat Source #

Constructors

Array [ArrayFormat] |
Plain ByteString |
Quoted ByteString |

#### Instances

Instances details

Show ArrayFormat Source # |
Instance details Defined in Database.PostgreSQL.Simple.Arrays Methods showsPrec :: Int -> ArrayFormat -> ShowS Source # show :: ArrayFormat -> String Source # showList :: [ArrayFormat] -> ShowS Source #
Eq ArrayFormat Source # |
Instance details Defined in Database.PostgreSQL.Simple.Arrays Methods (==) :: ArrayFormat -> ArrayFormat -> Bool Source # (/=) :: ArrayFormat -> ArrayFormat -> Bool Source #
Ord ArrayFormat Source # |

Instance details

Defined in Database.PostgreSQL.Simple.Arrays

Methods

compare :: ArrayFormat -> ArrayFormat -> Ordering Source #

(<) :: ArrayFormat -> ArrayFormat -> Bool Source #

(<=) :: ArrayFormat -> ArrayFormat -> Bool Source #

(>) :: ArrayFormat -> ArrayFormat -> Bool Source #

(>=) :: ArrayFormat -> ArrayFormat -> Bool Source #

max :: ArrayFormat -> ArrayFormat -> ArrayFormat Source #

min :: ArrayFormat -> ArrayFormat -> ArrayFormat Source #

array :: Char -> Parser [ArrayFormat] Source #

quoted :: Parser ByteString Source #

Recognizes a quoted string.

plain :: Char -> Parser ByteString Source #

Recognizes a plain string literal, not containing quotes or brackets and not containing the delimiter character.

fmt :: Char -> ArrayFormat -> ByteString Source #

Format an array format item, using the delimiter character if the item is itself an array.

delimit :: Char -> [ArrayFormat] -> ByteString Source #

Format a list of array format items, inserting the appropriate delimiter between them. When the items are arrays, they will be delimited with commas; otherwise, they are delimited with the passed-in-delimiter.

fmt' :: Bool -> Char -> ArrayFormat -> ByteString Source #

Format an array format item, using the delimiter character if the item is itself an array, optionally applying quoting rules. Creates copies for safety when used in `FromField` instances.

esc :: ByteString -> ByteString Source #

Escape a string according to Postgres double-quoted string format.