preql-0.5: safe PostgreSQL queries using Quasiquoters
Safe HaskellNone
LanguageHaskell2010

Preql.FromSql.Class

Synopsis

Documentation

data FieldDecoder a Source #

A FieldDecoder for a type a consists of an OID indicating the Postgres type which can be decoded, and a parser from the binary representation of that type to the Haskell representation.

Constructors

FieldDecoder PgType (BinaryParser a) 

Instances

Instances details
Functor FieldDecoder Source # 
Instance details

Defined in Preql.FromSql.Class

Methods

fmap :: (a -> b) -> FieldDecoder a -> FieldDecoder b #

(<$) :: a -> FieldDecoder b -> FieldDecoder a #

class FromSqlField a where Source #

Instances

Instances details
FromSqlField Bool Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Char Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Double Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Float Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Int16 Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Int32 Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Int64 Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField ByteString Source #

If you want to encode some more specific Haskell type via JSON, it is more efficient to use encode and jsonb_bytes directly, rather than this instance.

Instance details

Defined in Preql.FromSql.Instances

FromSqlField ByteString Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField String Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Text Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField UTCTime Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Value Source #

If you want to encode some more specific Haskell type via JSON, it is more efficient to use fromSqlJsonField rather than this instance.

Instance details

Defined in Preql.FromSql.Instances

FromSqlField Text Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField UUID Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Day Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField TimeOfDay Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField Oid Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField PgName Source # 
Instance details

Defined in Preql.FromSql.Instances

FromSqlField TimeTZ Source # 
Instance details

Defined in Preql.FromSql.Instances

class FromSql a where Source #

A type which can be decoded from a SQL row. Note that this includes the canonical order of fields.

The default (empty) instance works for any type with a FromSqlField instance

Minimal complete definition

Nothing

Associated Types

type Width a :: Nat Source #

The number of columns read in decoding this type.

type Width a = 1

Methods

fromSql :: RowDecoder (Width a) a Source #

default fromSql :: (FromSqlField a, Width a ~ 1) => RowDecoder (Width a) a Source #

Instances

Instances details
FromSql Bool Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Bool :: Nat Source #

FromSql Char Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Char :: Nat Source #

FromSql Double Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Double :: Nat Source #

FromSql Float Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Float :: Nat Source #

FromSql Int16 Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Int16 :: Nat Source #

FromSql Int32 Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Int32 :: Nat Source #

FromSql Int64 Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Int64 :: Nat Source #

FromSql ByteString Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width ByteString :: Nat Source #

FromSql ByteString Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width ByteString :: Nat Source #

FromSql String Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width String :: Nat Source #

FromSql Text Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Text :: Nat Source #

FromSql UTCTime Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width UTCTime :: Nat Source #

FromSql Value Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Value :: Nat Source #

FromSql Text Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Text :: Nat Source #

FromSql UUID Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width UUID :: Nat Source #

FromSql Day Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Day :: Nat Source #

FromSql TimeOfDay Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width TimeOfDay :: Nat Source #

FromSql Oid Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width Oid :: Nat Source #

FromSql PgName Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width PgName :: Nat Source #

FromSql TimeTZ Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width TimeTZ :: Nat Source #

FromSqlField a => FromSql (Maybe a) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (Maybe a) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (Maybe a)) (Maybe a) Source #

(FromSql a, FromSql b) => FromSql (a, b) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b)) (a, b) Source #

(FromSql a, FromSql b, FromSql c) => FromSql (a, b, c) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c)) (a, b, c) Source #

(FromSql a, FromSql b, FromSql c, FromSql d) => FromSql (a, b, c, d) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d)) (a, b, c, d) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e) => FromSql (a, b, c, d, e) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e)) (a, b, c, d, e) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f) => FromSql (a, b, c, d, e, f) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f)) (a, b, c, d, e, f) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g) => FromSql (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g)) (a, b, c, d, e, f, g) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h) => FromSql (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h)) (a, b, c, d, e, f, g, h) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i) => FromSql (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i)) (a, b, c, d, e, f, g, h, i) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j) => FromSql (a, b, c, d, e, f, g, h, i, j) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j)) (a, b, c, d, e, f, g, h, i, j) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k) => FromSql (a, b, c, d, e, f, g, h, i, j, k) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k)) (a, b, c, d, e, f, g, h, i, j, k) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l)) (a, b, c, d, e, f, g, h, i, j, k, l) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m)) (a, b, c, d, e, f, g, h, i, j, k, l, m) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r, FromSql s) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r, FromSql s, FromSql t) => FromSql (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 Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r, FromSql s, FromSql t, FromSql u) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r, FromSql s, FromSql t, FromSql u, FromSql v) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r, FromSql s, FromSql t, FromSql u, FromSql v, FromSql w) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r, FromSql s, FromSql t, FromSql u, FromSql v, FromSql w, FromSql x) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) Source #

(FromSql a, FromSql b, FromSql c, FromSql d, FromSql e, FromSql f, FromSql g, FromSql h, FromSql i, FromSql j, FromSql k, FromSql l, FromSql m, FromSql n, FromSql o, FromSql p, FromSql q, FromSql r, FromSql s, FromSql t, FromSql u, FromSql v, FromSql w, FromSql x, FromSql y) => FromSql (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) Source # 
Instance details

Defined in Preql.FromSql.Instances

Associated Types

type Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) :: Nat Source #

Methods

fromSql :: RowDecoder (Width (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) Source #

notNull :: FieldDecoder a -> RowDecoder 1 a Source #

Construct a decoder for a single non-nullable column.

nullable :: FieldDecoder a -> RowDecoder 1 (Maybe a) Source #

Construct a decoder for a single nullable column.