PgCompositeMapper

interface PgCompositeMapper<T : Any>

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

This is an alternative to reflection that can be manually implemented or generated by external tools.

Inheritors

Functions

Link copied to clipboard
abstract fun fromMap(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).

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

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