TypeManager

class TypeManager(registry: TypeRegistry, searchPathProvider: () -> List<String> = { emptyList() })

Manages the registration and resolution of PostgreSQL types, codecs, and converters.

This class provides a high-level API over TypeRegistry, making it easier to register custom mappings between Kotlin types and PostgreSQL database types.

Constructors

Link copied to clipboard
internal constructor(registry: TypeRegistry, searchPathProvider: () -> List<String> = { emptyList() })

Properties

Link copied to clipboard

The dictionary maintaining TypeCodec implementations.

Link copied to clipboard

Factory for creating container types (like composites).

Link copied to clipboard

The registry handling the conversion of parameters and results.

Link copied to clipboard

The dictionary mapping PostgreSQL type names to their OIDs and vice versa.

Functions

Link copied to clipboard
inline fun <T : Any> registerAutoComposite(typeName: String = "", schema: String = "")

Registers a composite type mapped reflectively onto the data class T.

fun registerAutoComposite(kClass: KClass<*>, typeName: String = "", schema: String = "")

Registers a composite type mapped reflectively onto the data class kClass.

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

Registers a custom TypeCodec for encoding and decoding database types at the lowest level.

Link copied to clipboard
inline fun <T : Enum<T>> registerEnum(typeName: String = "", schema: String = "", pgConvention: CaseConvention = CaseConvention.SNAKE_CASE_UPPER, kotlinConvention: CaseConvention = CaseConvention.PASCAL_CASE)
fun registerEnum(enumClass: KClass<*>, typeName: String = "", schema: String = "", pgConvention: CaseConvention = CaseConvention.SNAKE_CASE_UPPER, kotlinConvention: CaseConvention = CaseConvention.PASCAL_CASE)

Registers an enum type, creating both parameter and result converters.

Link copied to clipboard

Registers a custom ParameterConverter for mapping Kotlin types to PostgreSQL database types.

Link copied to clipboard

Registers a custom ResultConverter for mapping PostgreSQL database types to Kotlin types.

Link copied to clipboard
fun resolveOid(typeName: String, schema: String = "", isArray: Boolean = false): Int

Resolves an OID for a given type name, considering the current search path.