-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Encoders and decoders for the PostgreSQL's binary format
--
@package postgresql-binary
@version 0.1.0
-- | An intermediate array representation and utilities for its
-- (de)composition.
module PostgreSQLBinary.Array
-- | A representation of a data serializable to the PostgreSQL array binary
-- format.
--
-- Consists of a list of dimensions, a list of encoded elements, a flag
-- specifying, whether it contains any nulls, and an oid.
type Data = ([Dimension], [Value], Bool, Word32)
-- | A width and a lower bound.
--
-- Currently the lower bound is only allowed to have a value of
-- 1.
type Dimension = (Word32, Word32)
-- | An encoded value. Nothing if it represents a NULL.
type Value = Maybe ByteString
-- | Access a value of data, if the data represents a single value.
asSingleton :: Data -> Maybe Value
-- | Construct from a non-empty list, taking the shared parameters from the
-- first element.
fromListUnsafe :: [Data] -> Data
fromSingleton :: Value -> Bool -> Word32 -> Data
-- | Get a list of elements.
elements :: Data -> [Data]
module PostgreSQLBinary.Encoder
-- | A function for rendering a value into a byte string.
type E a = a -> ByteString
int2 :: E (Either Int16 Word16)
int4 :: E (Either Int32 Word32)
int8 :: E (Either Int64 Word64)
float4 :: E Float
float8 :: E Double
numeric :: E Scientific
-- | A UTF-8-encoded char.
--
-- Note that since it's UTF-8-encoded not a "char" but a "text" OID
-- should be used with it.
char :: E Char
-- | Either a strict or a lazy text.
text :: E (Either Text Text)
-- | Either a strict or a lazy bytestring.
bytea :: E (Either ByteString ByteString)
date :: E Day
time :: E TimeOfDay
timetz :: E (TimeOfDay, TimeZone)
timestamp :: E UTCTime
timestamptz :: E LocalTime
interval :: E DiffTime
bool :: E Bool
uuid :: E UUID
array :: E Data
module PostgreSQLBinary.Decoder
-- | A function for decoding a byte string into a value.
type D a = ByteString -> Either Text a
-- | Any of PostgreSQL integer types.
int :: (Integral a, Bits a) => D a
float4 :: D Float
float8 :: D Double
numeric :: D Scientific
-- | A UTF-8-encoded char.
char :: D Char
-- | Any of the variable-length character types: BPCHAR, VARCHAR, NAME and
-- TEXT.
text :: D Text
bytea :: D ByteString
date :: D Day
time :: D TimeOfDay
timetz :: D (TimeOfDay, TimeZone)
timestamp :: D UTCTime
timestamptz :: D LocalTime
interval :: D DiffTime
bool :: D Bool
uuid :: D UUID
-- | Arbitrary array.
--
-- Returns an intermediate representation, which can then be used to
-- decode into a specific data type.
array :: D Data