Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
PostgreSQL.Binary.Decoding
valueParser ::Value a ->ByteString ->EitherText aSource#
typeValue =BinaryParserSource#
bytea_strict ::ValueByteStringSource#
BYTEA or any other type in its undecoded form.
bytea_lazy ::Value LazyByteStringSource#
BYTEA or any other type in its undecoded form.
text_strict ::ValueTextSource#
Any of the variable-length character types: BPCHAR, VARCHAR, NAME and TEXT.
text_lazy ::Value LazyTextSource#
Any of the variable-length character types: BPCHAR, VARCHAR, NAME and TEXT.
json_bytes :: (ByteString ->EitherText a) ->Value aSource#
Given a function, which parses a plain UTF-8 JSON string encoded as a byte-array, produces a decoder.
jsonb_bytes :: (ByteString ->EitherText a) ->Value aSource#
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.
time_int ::ValueTimeOfDaySource#
TIME
values decoding for servers, which haveinteger_datetimes
enabled.
time_float ::ValueTimeOfDaySource#
TIME
values decoding for servers, which don't haveinteger_datetimes
enabled.
timetz_int ::Value (TimeOfDay,TimeZone)Source#
TIMETZ
values decoding for servers, which haveinteger_datetimes
enabled.
timetz_float ::Value (TimeOfDay,TimeZone)Source#
TIMETZ
values decoding for servers, which don't haveinteger_datetimes
enabled.
timestamp_int ::ValueLocalTimeSource#
TIMESTAMP
values decoding for servers, which haveinteger_datetimes
enabled.
timestamp_float ::ValueLocalTimeSource#
TIMESTAMP
values decoding for servers, which don't haveinteger_datetimes
enabled.
timestamptz_int ::ValueUTCTimeSource#
TIMESTAMP
values decoding for servers, which haveinteger_datetimes
enabled.
timestamptz_float ::ValueUTCTimeSource#
TIMESTAMP
values decoding for servers, which don't haveinteger_datetimes
enabled.
interval_int ::ValueDiffTimeSource#
INTERVAL
values decoding for servers, which don't haveinteger_datetimes
enabled.
interval_float ::ValueDiffTimeSource#
INTERVAL
values decoding for servers, which haveinteger_datetimes
enabled.
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))))
valueArray ::Value a ->Array aSource#
dimensionArray :: (forall m.Monad m =>Int -> m a -> m b) ->Array a ->Array bSource#
A function for parsing a dimension of an array. Provides support for multi-dimensional arrays.
Accepts:
replicateM
function (Control.Monad.replicateM
,Data.Vector.replicateM
), which determines the output value.dimensionArray
ornullableValueArray
.hstore :: (forall m.Monad m =>Int -> m (k,Maybe v) -> m r) ->Value k ->Value v ->Value rSource#
A function for generic in place parsing of an HStore value.
Accepts:
replicateM
function (Control.Monad.replicateM
,Data.Vector.replicateM
), which determines how to produce the final datastructure from the rows.Here's how you can use it to produce a parser to list:
hstoreAsList :: Value [ ( Text , Maybe Text ) ]hstoreAsList = hstore replicateM text text
Produced byHaddock version 2.26.0