Skip to content

PgTypeTextCodec<T>

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Defines the SQL text representation of a PostgreSQL base type independently of its storage format.

public abstract class PgTypeTextCodec<T>

Type parameters:

T

The exact managed type carrying PgType.

Select this codec through TextCodec to retain generated storage: CBOR by default, or packed native bytes with NativeLayout. Ankus constructs one instance on first text use inside the managed error boundary. Binary operations do not construct or invoke the text codec. Do not retain PostgreSQL call state in the instance. Throw PgException to supply a PostgreSQL SQLSTATE and owned error diagnostics.

Inheritance: object

protected PgTypeTextCodec()

Formats a present managed value for SQL text output.

public abstract string Format(T value)

Parameters:

value — T

The present managed value.

Returns: string

The non-null text representation without a zero terminator.

Parses a present SQL text representation into an independent managed value.

public abstract T Parse(string text)

Parameters:

text — string

The input converted from the database encoding.

Returns: T

The non-null parsed value.