ContainerCodec

internal object ContainerCodec

Utility object for parsing and serializing PostgreSQL container types. Supports arrays, composites, records, ranges, and multiranges.

Functions

Link copied to clipboard
fun parseContainer(data: ByteArray, offset: Int, oid: Int, typeRegistry: TypeRegistry): PgContainer

Parses a byte array into a PgContainer based on the OID.

Link copied to clipboard
fun parsePgArray(data: ByteArray, offset: Int, oid: Int, typeRegistry: TypeRegistry): PgArray

Parses a PostgreSQL array from its binary format.

Link copied to clipboard
fun parsePgComposite(data: ByteArray, offset: Int, oid: Int, typeRegistry: TypeRegistry): PgComposite

Parses a PostgreSQL composite type (row) from its binary format.

Link copied to clipboard
fun parsePgMultirange(data: ByteArray, offset: Int, oid: Int, typeRegistry: TypeRegistry): PgMultirange

Parses a PostgreSQL multirange type from its binary format.

Link copied to clipboard
fun parsePgRange(data: ByteArray, offset: Int, oid: Int, typeRegistry: TypeRegistry): PgRange

Parses a PostgreSQL range type from its binary format.

Link copied to clipboard
fun parsePgRecord(data: ByteArray, offset: Int, oid: Int, typeRegistry: TypeRegistry): PgRecord

Parses an anonymous PostgreSQL record type from its binary format.

Link copied to clipboard
fun serializeContainer(container: PgContainer, writer: PgByteWriter, typeRegistry: TypeRegistry)

Serializes a PgContainer into the provided PgByteWriter.

Link copied to clipboard
fun serializePgArray(array: PgArray, writer: PgByteWriter, typeRegistry: TypeRegistry)

Serializes a PgArray into the provided PgByteWriter.

Link copied to clipboard
fun serializePgComposite(composite: PgComposite, writer: PgByteWriter, typeRegistry: TypeRegistry)

Serializes a PgComposite into the provided PgByteWriter.

Link copied to clipboard
fun serializePgMultirange(multirange: PgMultirange, writer: PgByteWriter, typeRegistry: TypeRegistry)

Serializes a PgMultirange into the provided PgByteWriter.

Link copied to clipboard
fun serializePgRange(range: PgRange, writer: PgByteWriter, typeRegistry: TypeRegistry)

Serializes a PgRange into the provided PgByteWriter.

Link copied to clipboard

Attempting to serialize an anonymous record will throw an exception, since PostgreSQL does not accept anonymous records as bound parameters.