PgCompositeMapper

Interface for manual (non-reflective) mapping of a data class to/from a Map. Used for PostgreSQL composite types to bypass reflection-based mapping and improve performance.

Inherits from DataMapper for one-way mapping (Map -> Object) and adds toDataMap for the reverse direction (Object -> Map) required for database writes.

Inheritors

Functions

Link copied to clipboard
abstract fun toDataMap(obj: T): Map<String, Any?>

Converts the provided object obj to a Map. The map keys should match the PostgreSQL composite attribute names.

Link copied to clipboard
abstract fun toDataObject(map: Map<String, Any?>): T

Creates an instance of T from the provided map. The map keys are the attribute names (typically in snake_case as they come from DB).