-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Encoders and decoders for the PostgreSQL's binary format -- -- An API for dealing with PostgreSQL's binary data format. . It can be -- used to implement performant bindings to Postgres. E.g., hasql -- is based on this library. . It supports all Postgres versions starting -- from 8.3 and is tested against 8.3, 9.3 and 9.5 with the -- integer_datetimes setting off and on. @package postgresql-binary @version 0.13.1.1 module PostgreSQL.Binary.Encoding type Encoding = Builder encodingBytes :: Encoding -> ByteString composite :: Composite -> Encoding -- | Turn an array builder into final value. The first parameter is OID of -- the element type. array :: Word32 -> Array -> Encoding -- | A helper for encoding of arrays of single dimension from foldables. -- The first parameter is OID of the element type. array_foldable :: Foldable foldable => Word32 -> (element -> Maybe Encoding) -> foldable element -> Encoding -- | A helper for encoding of arrays of single dimension from vectors. The -- first parameter is OID of the element type. array_vector :: Word32 -> (element -> Encoding) -> Vector element -> Encoding -- | A helper for encoding of arrays of single dimension from vectors. The -- first parameter is OID of the element type. nullableArray_vector :: Word32 -> (element -> Encoding) -> Vector (Maybe element) -> Encoding -- | A polymorphic HSTORE encoder. hStore_foldable :: Foldable foldable => foldable (Text, Maybe Text) -> Encoding -- | HSTORE encoder from HashMap. hStore_hashMap :: HashMap Text (Maybe Text) -> Encoding -- | HSTORE encoder from Map. hStore_map :: Map Text (Maybe Text) -> Encoding bool :: Bool -> Encoding int2_int16 :: Int16 -> Encoding int2_word16 :: Word16 -> Encoding int4_int32 :: Int32 -> Encoding int4_word32 :: Word32 -> Encoding int8_int64 :: Int64 -> Encoding int8_word64 :: Word64 -> Encoding float4 :: Float -> Encoding float8 :: Double -> Encoding numeric :: Scientific -> Encoding uuid :: UUID -> Encoding inet :: NetAddr IP -> Encoding char_utf8 :: Char -> Encoding text_strict :: Text -> Encoding text_lazy :: Text -> Encoding bytea_strict :: ByteString -> Encoding bytea_lazy :: ByteString -> Encoding date :: Day -> Encoding time_int :: TimeOfDay -> Encoding time_float :: TimeOfDay -> Encoding timetz_int :: (TimeOfDay, TimeZone) -> Encoding timetz_float :: (TimeOfDay, TimeZone) -> Encoding timestamp_int :: LocalTime -> Encoding timestamp_float :: LocalTime -> Encoding timestamptz_int :: UTCTime -> Encoding timestamptz_float :: UTCTime -> Encoding interval_int :: DiffTime -> Encoding interval_float :: DiffTime -> Encoding json_bytes :: ByteString -> Encoding json_bytes_lazy :: ByteString -> Encoding json_ast :: Value -> Encoding jsonb_bytes :: ByteString -> Encoding jsonb_bytes_lazy :: ByteString -> Encoding jsonb_ast :: Value -> Encoding -- | Abstraction for encoding into multidimensional array. data Array encodingArray :: Encoding -> Array nullArray :: Array dimensionArray :: (forall b. (b -> a -> b) -> b -> c -> b) -> (a -> Array) -> c -> Array data Composite field :: Word32 -> Encoding -> Composite nullField :: Word32 -> Composite instance GHC.Base.Semigroup PostgreSQL.Binary.Encoding.Composite instance GHC.Base.Monoid PostgreSQL.Binary.Encoding.Composite module PostgreSQL.Binary.Decoding valueParser :: Value a -> ByteString -> Either Text a type Value = BinaryParser int :: (Integral a, Bits a) => Value a float4 :: Value Float float8 :: Value Double bool :: Value Bool -- | BYTEA or any other type in its undecoded form. bytea_strict :: Value ByteString -- | BYTEA or any other type in its undecoded form. bytea_lazy :: Value LazyByteString -- | Any of the variable-length character types: BPCHAR, VARCHAR, NAME and -- TEXT. text_strict :: Value Text -- | Any of the variable-length character types: BPCHAR, VARCHAR, NAME and -- TEXT. text_lazy :: Value LazyText -- | A UTF-8-decoded char. char :: Value Char -- | Lifts a custom decoder implementation. fn :: (ByteString -> Either Text a) -> Value a numeric :: Value Scientific uuid :: Value UUID inet :: Value (NetAddr IP) json_ast :: Value Value -- | Given a function, which parses a plain UTF-8 JSON string encoded as a -- byte-array, produces a decoder. json_bytes :: (ByteString -> Either Text a) -> Value a jsonb_ast :: Value Value -- | Given a function, which parses a plain UTF-8 JSON string encoded as a -- byte-array, produces a decoder. -- -- For those wondering, yes, JSONB is encoded as plain JSON string in the -- binary format of Postgres. Sad, but true. jsonb_bytes :: (ByteString -> Either Text a) -> Value a -- | DATE values decoding. date :: Value Day -- | TIME values decoding for servers, which have -- integer_datetimes enabled. time_int :: Value TimeOfDay -- | TIME values decoding for servers, which don't have -- integer_datetimes enabled. time_float :: Value TimeOfDay -- | TIMETZ values decoding for servers, which have -- integer_datetimes enabled. timetz_int :: Value (TimeOfDay, TimeZone) -- | TIMETZ values decoding for servers, which don't have -- integer_datetimes enabled. timetz_float :: Value (TimeOfDay, TimeZone) -- | TIMESTAMP values decoding for servers, which have -- integer_datetimes enabled. timestamp_int :: Value LocalTime -- | TIMESTAMP values decoding for servers, which don't have -- integer_datetimes enabled. timestamp_float :: Value LocalTime -- | TIMESTAMP values decoding for servers, which have -- integer_datetimes enabled. timestamptz_int :: Value UTCTime -- | TIMESTAMP values decoding for servers, which don't have -- integer_datetimes enabled. timestamptz_float :: Value UTCTime -- | INTERVAL values decoding for servers, which don't have -- integer_datetimes enabled. interval_int :: Value DiffTime -- | INTERVAL values decoding for servers, which have -- integer_datetimes enabled. interval_float :: Value DiffTime -- | An efficient generic array decoder, which constructs the result value -- in place while parsing. -- -- Here's how you can use it to produce a specific array value decoder: -- --
-- x :: Value [ [ Text ] ] -- x = -- array (dimensionArray replicateM (fmap catMaybes (dimensionArray replicateM (nullableValueArray text)))) --data Array a -- | Unlift an Array to a value Value. array :: Array a -> Value a -- | Lift a value Value into Array for parsing of -- non-nullable leaf values. valueArray :: Value a -> Array a -- | Lift a value Value into Array for parsing of nullable -- leaf values. nullableValueArray :: Value a -> Array (Maybe a) -- | A function for parsing a dimension of an array. Provides support for -- multi-dimensional arrays. -- -- Accepts: -- --
-- hstoreAsList :: Value [ ( Text , Maybe Text ) ] -- hstoreAsList = -- hstore replicateM text text --hstore :: (forall m. Monad m => Int -> m (k, Maybe v) -> m r) -> Value k -> Value v -> Value r -- | Given a partial mapping from text to value, produces a decoder of that -- value. enum :: (Text -> Maybe a) -> Value a -- | Given additional constraints when using an existing value decoder, -- produces a decoder of that value. refine :: (a -> Either Text b) -> Value a -> Value b instance Control.Monad.Fail.MonadFail PostgreSQL.Binary.Decoding.Composite instance GHC.Base.Monad PostgreSQL.Binary.Decoding.Composite instance GHC.Base.Applicative PostgreSQL.Binary.Decoding.Composite instance GHC.Base.Functor PostgreSQL.Binary.Decoding.Composite instance GHC.Base.Functor PostgreSQL.Binary.Decoding.Array