postgresql-binary-0.9.1.1: Encoders and decoders for the PostgreSQL's binary format

Safe HaskellNone
LanguageHaskell2010

PostgreSQL.Binary.Encoder

Contents

Synopsis

Documentation

Value encoder

type Encoder a = a -> Builder Source #

char :: Encoder Char Source #

A UTF-8-encoded char.

Note that since it's UTF-8-encoded not the "char" but the "text" OID should be used with it.

hstore :: (forall a. (a -> (Text, Maybe Text) -> a) -> a -> b -> a) -> Encoder b Source #

A polymorphic in-place HSTORE encoder.

Accepts:

  • An implementation of the foldl function (e.g., Data.Foldable.foldl'), which determines the input value.

Here's how you can use it to produce a specific encoder:

hashMapHStore :: Encoder (Data.HashMap.Strict.HashMap Text (Maybe Text))
hashMapHStore =
  hstore foldl'

Array encoder

arrayDimension :: (forall a. (a -> b -> a) -> a -> c -> a) -> ArrayEncoder b -> ArrayEncoder c Source #

Enum

enum :: (a -> Text) -> Encoder a Source #

Given a function, which maps the value into the textual enum label from the DB side, produces an encoder of that value