DynamicContainerCodec

internal class DynamicContainerCodec<T : PgContainer>(val oid: Int, val pgTypeName: String, val pgSchema: String, val kotlinClass: KClass<T>, typeRegistry: TypeRegistry) : TypeCodec<T>

Dynamic codec for PostgreSQL container types (Array, Composite, Range, Multirange, Record). It delegates the actual parsing and serialization to the ContainerCodec object.

Constructors

Link copied to clipboard
constructor(oid: Int, pgTypeName: String, pgSchema: String, kotlinClass: KClass<T>, typeRegistry: TypeRegistry)

Properties

Link copied to clipboard
open override val fromBinary: (ByteArray, Int, Int) -> T

Function to deserialize a value from a PostgreSQL binary format.

Link copied to clipboard
open override val isDefaultForKotlinType: Boolean = false

Whether this codec is the default for its Kotlin type.

Link copied to clipboard
open override val kotlinClass: KClass<T>

The Kotlin class this codec handles.

Link copied to clipboard
open override val oid: Int

Optional OID of the PostgreSQL type.

Link copied to clipboard
open override val pgSchema: String

PostgreSQL schema name

Link copied to clipboard
open override val pgTypeName: String

PostgreSQL type name.

Link copied to clipboard
open override val toBinary: (T, PgByteWriter) -> Unit

Function to serialize a value to a PostgreSQL binary format.

Functions

Link copied to clipboard
internal fun <T : Any> TypeCodec<T>.decodeSafely(data: ByteArray, offset: Int, length: Int): T

Safely decodes a value using this TypeCodec. Any standard exceptions (like IllegalArgumentException or IllegalStateException) thrown by the codec's TypeCodec.fromBinary method are caught and wrapped in a CodecException.

Link copied to clipboard
internal fun <T : Any> TypeCodec<T>.encodeSafely(value: T, writer: PgByteWriter)

Safely encodes a value using this TypeCodec. Any standard exceptions (like IllegalArgumentException or IllegalStateException) thrown by the codec's TypeCodec.toBinary method are caught and wrapped in a CodecException.