Movatterモバイル変換


[0]ホーム

URL:


postgresql-binary-0.13: Encoders and decoders for the PostgreSQL's binary format
Safe HaskellSafe-Inferred
LanguageHaskell2010

PostgreSQL.Binary.Decoding

Contents

Synopsis

Documentation

valueParser ::Value a ->ByteString ->EitherText aSource#

typeValue =BinaryParserSource#

Primitive

int :: (Integral a,Bits a) =>Value aSource#

float4 ::ValueFloatSource#

float8 ::ValueDoubleSource#

bool ::ValueBoolSource#

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.

Textual

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.

char ::ValueCharSource#

A UTF-8-decoded char.

Misc

fn :: (ByteString ->EitherText a) ->Value aSource#

Lifts a custom decoder implementation.

numeric ::ValueScientificSource#

uuid ::ValueUUIDSource#

inet ::Value (NetAddrIP)Source#

json_ast ::ValueValueSource#

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_ast ::ValueValueSource#

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

date ::ValueDaySource#

DATE values decoding.

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.

Exotic

Array

dataArray 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 :: Value [ [ Text ] ]x =  array (dimensionArray replicateM (fmap catMaybes (dimensionArray replicateM (nullableValueArray text))))

Instances

Instances details
FunctorArraySource# 
Instance details

Defined inPostgreSQL.Binary.Decoding

Methods

fmap :: (a -> b) ->Array a ->Array b#

(<$) :: a ->Array b ->Array a#

array ::Array a ->Value aSource#

Unlift anArray to a valueValue.

valueArray ::Value a ->Array aSource#

Lift a valueValue intoArray for parsing of non-nullable leaf values.

nullableValueArray ::Value a ->Array (Maybe a)Source#

Lift a valueValue intoArray for parsing of nullable leaf values.

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:

Composite

dataComposite aSource#

Instances

Instances details
MonadFailCompositeSource# 
Instance details

Defined inPostgreSQL.Binary.Decoding

Methods

fail ::String ->Composite a#

ApplicativeCompositeSource# 
Instance details

Defined inPostgreSQL.Binary.Decoding

Methods

pure :: a ->Composite a#

(<*>) ::Composite (a -> b) ->Composite a ->Composite b#

liftA2 :: (a -> b -> c) ->Composite a ->Composite b ->Composite c#

(*>) ::Composite a ->Composite b ->Composite b#

(<*) ::Composite a ->Composite b ->Composite a#

FunctorCompositeSource# 
Instance details

Defined inPostgreSQL.Binary.Decoding

Methods

fmap :: (a -> b) ->Composite a ->Composite b#

(<$) :: a ->Composite b ->Composite a#

MonadCompositeSource# 
Instance details

Defined inPostgreSQL.Binary.Decoding

Methods

(>>=) ::Composite a -> (a ->Composite b) ->Composite b#

(>>) ::Composite a ->Composite b ->Composite b#

return :: a ->Composite a#

composite ::Composite a ->Value aSource#

Unlift aComposite to a valueValue.

valueComposite ::Value a ->Composite aSource#

Lift a non-nullable valueValue intoComposite.

nullableValueComposite ::Value a ->Composite (Maybe a)Source#

Lift a valueValue intoComposite.

HStore

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:

  • An implementation of thereplicateM function (Control.Monad.replicateM,Data.Vector.replicateM), which determines how to produce the final datastructure from the rows.
  • A decoder for keys.
  • A decoder for values.

Here's how you can use it to produce a parser to list:

hstoreAsList :: Value [ ( Text , Maybe Text ) ]hstoreAsList =  hstore replicateM text text

enum :: (Text ->Maybe a) ->Value aSource#

Given a partial mapping from text to value, produces a decoder of that value.

refine :: (a ->EitherText b) ->Value a ->Value bSource#

Given additional constraints when using an existing value decoder, produces a decoder of that value.

Produced byHaddock version 2.26.0


[8]ページ先頭

©2009-2025 Movatter.jp