PgComposite

class PgComposite(val type: PgType.Composite, val fields: Array<Any?>) : PgContainer

Represents a composite structure (e.g., row of a specific type) loaded from the database.

Constructors

Link copied to clipboard
internal constructor(type: PgType.Composite, fields: Array<Any?>)

Properties

Link copied to clipboard

The names of this composite's attributes, in declaration order.

Link copied to clipboard
open override val containerOid: Int

OID of the container's own type — the array type rather than its element type, the range type rather than its subtype.

Link copied to clipboard

Array containing the values of the fields in this composite structure.

Link copied to clipboard

The composite type definition.

Functions

Link copied to clipboard
inline fun <T> get(index: Int): T

Returns the attribute at index, cast to T.

inline fun <T> get(name: String): T

Returns the attribute named name, cast to T.

Link copied to clipboard
fun getAttributeOid(index: Int): Int

Returns the PostgreSQL OID of the attribute at index.

Returns the PostgreSQL OID of the attribute named name.

Link copied to clipboard
fun getColumnIndex(columnName: String): Int

Resolves an attribute name to its zero-based index.

Link copied to clipboard
operator fun set(index: Int, newValue: Any?)

Sets the attribute at index. The value is converted when the composite is sent, not here, so nothing is checked against the attribute's type at this point.

operator fun set(columnName: String, newValue: Any?)

Sets the attribute named columnName.