TypeRegistry

internal class TypeRegistry

Registry holding the mapping of database types, data codecs, and type converters.

TypeRegistry manages the state for mapping PostgreSQL Object Identifiers (OIDs) to their corresponding type definitions (PgType), as well as providing resolution mechanisms for parameter encoders, result decoders, and data serialization.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

An immutable snapshot dictionary for database binary/text codecs.

Link copied to clipboard

The registry handling custom mappings and converters between Kotlin objects and PostgreSQL types.

Link copied to clipboard

An immutable snapshot dictionary representing the current mapping of PostgreSQL OIDs and types.

Link copied to clipboard
Link copied to clipboard

A lock used to ensure thread-safe updates to the registry's internal state.

Functions

Link copied to clipboard
fun registerCodec(codec: TypeCodec<*>)

Registers a custom codec. If OID and schema are missing (dynamic type in multi-schema), it will be mapped globally for deserialization but resolved in-flight for serialization.

Link copied to clipboard
fun updateTypes(newTypes: Map<Int, PgType>)

Replaces the entire type map with a new instance, ensuring thread-safety. Additionally applies custom codecs waiting for an OID.