Safe Haskell | None |
---|---|
Language | Haskell2010 |
PostgreSQL.Binary.Decoder
Synopsis
run ::BinaryParser a ->ByteString ->EitherText a
Apply a parser to bytes.
bytea_strict ::DecoderByteStringSource
BYTEA or any other type in its undecoded form.
bytea_lazy ::Decoder LazyByteStringSource
BYTEA or any other type in its undecoded form.
text_strict ::DecoderTextSource
Any of the variable-length character types: BPCHAR, VARCHAR, NAME and TEXT.
text_lazy ::Decoder LazyTextSource
Any of the variable-length character types: BPCHAR, VARCHAR, NAME and TEXT.
json_bytes :: (ByteString ->EitherText a) ->Decoder 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) ->Decoder 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 ::DecoderTimeOfDaySource
TIME
values decoding for servers, which haveinteger_datetimes
enabled.
time_float ::DecoderTimeOfDaySource
TIME
values decoding for servers, which don't haveinteger_datetimes
enabled.
timetz_int ::Decoder (TimeOfDay,TimeZone)Source
TIMETZ
values decoding for servers, which haveinteger_datetimes
enabled.
timetz_float ::Decoder (TimeOfDay,TimeZone)Source
TIMETZ
values decoding for servers, which don't haveinteger_datetimes
enabled.
timestamp_int ::DecoderLocalTimeSource
TIMESTAMP
values decoding for servers, which haveinteger_datetimes
enabled.
timestamp_float ::DecoderLocalTimeSource
TIMESTAMP
values decoding for servers, which don't haveinteger_datetimes
enabled.
timestamptz_int ::DecoderUTCTimeSource
TIMESTAMP
values decoding for servers, which haveinteger_datetimes
enabled.
timestamptz_float ::DecoderUTCTimeSource
TIMESTAMP
values decoding for servers, which don't haveinteger_datetimes
enabled.
interval_int ::DecoderDiffTimeSource
INTERVAL
values decoding for servers, which don't haveinteger_datetimes
enabled.
interval_float ::DecoderDiffTimeSource
INTERVAL
values decoding for servers, which haveinteger_datetimes
enabled.
dataArrayDecoder aSource
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 :: Decoder [ [ Text ] ]x = array (arrayDimension replicateM (fmap catMaybes (arrayDimension replicateM (arrayValue text))))
Instances
array ::ArrayDecoder a ->Decoder aSource
Unlift anArrayDecoder
to a valueDecoder
.
arrayDimension :: (forall m.Monad m =>Int -> m a -> m b) ->ArrayDecoder a ->ArrayDecoder 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.arrayDimension
orarrayValue
.arrayValue ::Decoder a ->ArrayDecoder (Maybe a)Source
Lift a valueDecoder
intoArrayDecoder
for parsing of nullable leaf values.
arrayNonNullValue ::Decoder a ->ArrayDecoder aSource
Lift a valueDecoder
intoArrayDecoder
for parsing of non-nullable leaf values.
dataCompositeDecoder aSource
composite ::CompositeDecoder a ->Decoder aSource
Unlift aCompositeDecoder
to a valueDecoder
.
compositeValue ::Decoder a ->CompositeDecoder (Maybe a)Source
Lift a valueDecoder
intoCompositeDecoder
.
compositeNonNullValue ::Decoder a ->CompositeDecoder aSource
Lift a non-nullable valueDecoder
intoCompositeDecoder
.
hstore :: (forall m.Monad m =>Int -> m (k,Maybe v) -> m r) ->Decoder k ->Decoder v ->Decoder 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 :: Decoder [ ( Text , Maybe Text ) ]hstoreAsList = hstore replicateM text text
Produced byHaddock version 2.16.1