dpeq.marshalling

Primitives used for marshalling.

Members

Aliases

VariantDemarshaller
alias VariantDemarshaller = NullableVariant function(const(ubyte)[] buf, in FormatCode fc, in int len)

prototype of a nullable variant demarshaller, used in converter

Classes

VariantConverter
class VariantConverter(alias Marsh = DefaultFieldMarshaller)

Default converter hash map. You can extend it, or define your own.

Functions

demarshalFixedField
T demarshalFixedField(const(ubyte)[] from, FormatCode fCode, int len)
Undocumented in source. Be warned that the author may not have intended to support it.
demarshalNullableFixedField
Nullable!T demarshalNullableFixedField(const(ubyte)[] from, FormatCode fCode, int len)
Undocumented in source. Be warned that the author may not have intended to support it.
demarshalNullableStringField
Nullable!string demarshalNullableStringField(const(ubyte)[] from, FormatCode fc, int len)

returns inplace-constructed string without allocations. Hacky.

demarshalNullableUuidField
Nullable!UUID demarshalNullableUuidField(const(ubyte)[] from, FormatCode fc, int len)
Undocumented in source. Be warned that the author may not have intended to support it.
demarshalNumber
T demarshalNumber(const(ubyte)[] from)

Simple demarshal of some numeric type.

demarshalProtocolString
string demarshalProtocolString(const(ubyte)[] from, size_t length)

dpeq utility function. Demarshal zero-terminated string from byte buffer.

demarshalString
string demarshalString(const(ubyte)[] from)

dpeq utility function

demarshalStringField
string demarshalStringField(const(ubyte)[] from, FormatCode fc, int len)
Undocumented in source. Be warned that the author may not have intended to support it.
demarshalUuidField
UUID demarshalUuidField(const(ubyte)[] from, FormatCode fc, int len)
Undocumented in source. Be warned that the author may not have intended to support it.
marshalCstring
int marshalCstring(ubyte[] to, string s)

Service function, used for marshalling of protocol messages. Data strings are passed without trailing nulls.

marshalFixedField
int marshalFixedField(ubyte[] to, T val)
Undocumented in source. Be warned that the author may not have intended to support it.
marshalNull
int marshalNull(ubyte[] to)
Undocumented in source. Be warned that the author may not have intended to support it.
marshalNullableFixedField
int marshalNullableFixedField(ubyte[] to, Nullable!T ptr)
Undocumented in source. Be warned that the author may not have intended to support it.
marshalNullableStringField
int marshalNullableStringField(ubyte[] to, Nullable!string val)
Undocumented in source. Be warned that the author may not have intended to support it.
marshalNullableUuidField
int marshalNullableUuidField(ubyte[] to, Nullable!UUID val)
Undocumented in source. Be warned that the author may not have intended to support it.
marshalStringField
int marshalStringField(ubyte[] to, string s)
Undocumented in source. Be warned that the author may not have intended to support it.
marshalUuidField
int marshalUuidField(ubyte[] to, UUID val)
Undocumented in source. Be warned that the author may not have intended to support it.
to
bool to(string s)

psql uses t and f for boolean

wrapToVariant
NullableVariant wrapToVariant(const(ubyte)[] buf, FormatCode fc, int len)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixin templates

MarshTemplate
mixintemplate MarshTemplate(NativeT, FormatCode fcode, string suffix)
Undocumented in source.

Structs

FieldSpec
struct FieldSpec

Value type descriptor, constisting of an oid of the type itself and a boolean flag wich indicates wether the value can be null.

NullableVariant
struct NullableVariant

std.variant.Variant subtype that is better suited for holding SQL null. Null NullableVariant is essentially a valueless Variant instance.

Templates

DefaultFieldMarshaller
template DefaultFieldMarshaller(FieldSpec field, alias Pre = NopMarshaller, alias Post = PromiscuousStringMarshaller)

Default compile-time one-to-many mapper, wich for ObjectID of some Postgress type gives it's native type representation, and marshalling and demarshalling functions. You can extend it with two custom mappers: Pre and Post.

FCodeOfFSpec
template FCodeOfFSpec(alias Marsh = DefaultFieldMarshaller)
Undocumented in source.
FSpecsToFCodes
template FSpecsToFCodes(FieldSpec[] specs, alias Marsh = DefaultFieldMarshaller)

Utility template to quickly get an array of format codes from an array of FieldSpecs

NopMarshaller
template NopMarshaller(FieldSpec type)

Can't marshal shit

PromiscuousStringMarshaller
template PromiscuousStringMarshaller(FieldSpec field)

This is a fallback marshaller that simply accepts any type as a string

StaticFieldMarshaller
template StaticFieldMarshaller(FieldSpec field)

Types handled by dpeq natively

Meta

Authors

Boris-Barboris