PgTypeCodec<T>
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Defines the text and binary storage representations of a generated PostgreSQL base type.
public abstract class PgTypeCodec<T> : PgTypeTextCodec<T>Type parameters:
T
The managed type carrying PgType.
The generated mapping constructs one codec on first use inside the managed error boundary. Implementations must not retain borrowed input buffers or PostgreSQL call state. Storage bytes exclude PostgreSQL’s variable-length header. Preserve the storage format across extension upgrades or provide an explicit data migration.
Inheritance: object, PgTypeTextCodec<T>
Constructors
Section titled “Constructors”PgTypeCodec()
Section titled “PgTypeCodec()”protected PgTypeCodec()Methods
Section titled “Methods”Read(ReadOnlySpan<byte>)
Section titled “Read(ReadOnlySpan<byte>)”Reads an independent managed value from the complete stored payload.
public abstract T Read(ReadOnlySpan<byte> payload)Parameters:
payload — ReadOnlySpan<byte>
The borrowed payload, valid only during this call.
Returns: T
The decoded value.
Write(T, IBufferWriter<byte>)
Section titled “Write(T, IBufferWriter<byte>)”Writes the complete stored payload for a present managed value.
public abstract void Write(T value, IBufferWriter<byte> destination)Parameters:
value — T
The value to store.
destination — IBufferWriter<byte>
The output buffer; do not retain it after this call.