postgresql-simple-0.7.0.1: 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.ToRow

Description

The `ToRow` typeclass, for rendering a collection of parameters to a SQL query.

Predefined instances are provided for tuples containing up to ten elements.

Synopsis

- class ToRow a where
  - toRow :: a -> [Action]

# Documentation

class ToRow a where Source #

A collection type that can be turned into a list of rendering `Action`s.

Instances should use the `toField` method of the `ToField` class to perform conversion of each element of the collection.

You can derive `ToRow` for your data type using GHC generics, like this:

    {-# LANGUAGE DeriveAnyClass #-}
    {-# LANGUAGE DeriveGeneric  #-}

    import GHC.Generics (Generic)
    import Database.PostgreSQL.Simple (ToRow)

    data User = User { name :: String, fileQuota :: Int }
      deriving (Generic, ToRow)

Note that this only works for product types (e.g. records) and does not support sum types or recursive types.

Minimal complete definition

Nothing

Methods

toRow :: a -> [Action] Source #

default toRow :: (Generic a, GToRow (Rep a)) => a -> [Action] Source #

#### Instances

Instances details

ToRow () Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: () -> [Action] Source #
ToField a => ToRow (Only a) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: Only a -> [Action] Source #
ToField a => ToRow [a] Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: [a] -> [Action] Source #
(ToRow a, ToRow b) => ToRow (a :. b) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a :. b) -> [Action] Source #
(ToField a, ToField b) => ToRow (a, b) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b) -> [Action] Source #
(ToField a, ToField b, ToField c) => ToRow (a, b, c) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d) => ToRow (a, b, c, d) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e) => ToRow (a, b, c, d, e) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f) => ToRow (a, b, c, d, e, f) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g) => ToRow (a, b, c, d, e, f, g) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h) => ToRow (a, b, c, d, e, f, g, h) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i) => ToRow (a, b, c, d, e, f, g, h, i) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j) => ToRow (a, b, c, d, e, f, g, h, i, j) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k) => ToRow (a, b, c, d, e, f, g, h, i, j, k) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m, ToField n) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m, ToField n, ToField o) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m, ToField n, ToField o, ToField p) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m, ToField n, ToField o, ToField p, ToField q) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m, ToField n, ToField o, ToField p, ToField q, ToField r) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m, ToField n, ToField o, ToField p, ToField q, ToField r, ToField s) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) -> [Action] Source #
(ToField a, ToField b, ToField c, ToField d, ToField e, ToField f, ToField g, ToField h, ToField i, ToField j, ToField k, ToField l, ToField m, ToField n, ToField o, ToField p, ToField q, ToField r, ToField s, ToField t) => ToRow (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) Source # |
Instance details Defined in Database.PostgreSQL.Simple.ToRow Methods toRow :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) -> [Action] Source #