English | 简体中文

api-docs / me.liuwj.ktorm.jackson / JsonSqlType

JsonSqlType

class JsonSqlType<T : Any> : SqlType<T> (source code)

SqlType implementation that provides JSON data type support via Jackson framework.

Constructors

NameSummary

<init>

JsonSqlType(objectMapper: ObjectMapper, javaType: JavaType)

SqlType implementation that provides JSON data type support via Jackson framework.

Properties

NameSummary

javaType

val javaType: JavaType

the generic type infomation represented as Jackson’s JavaType.

objectMapper

val objectMapper: ObjectMapper

the object mapper used to serialize column values to JSON strings and deserialize them.

Inherited Properties

NameSummary

typeCode

val typeCode: Int

a constant value defined in java.sql.Types to identify JDBC types.

typeName

val typeName: String

the name of the type in specific databases, such as int, bigint, varchar, etc.

Functions

NameSummary

doGetResult

fun doGetResult(rs: ResultSet, index: Int): T?

Obtain a result from a given ResultSet by index, the result may be null.

doSetParameter

fun doSetParameter(
    ps: PreparedStatement,
    index: Int,
    parameter: T
): Unit

Set the parameter to a given PreparedStatement, the parameter can’t be null.

Inherited Functions

NameSummary

equals

open fun equals(other: Any?): Boolean

Indicates whether some other object is “equal to” this SQL type.
Two SQL types are equal if they have the same type codes and names.

getResult

open fun getResult(rs: ResultSet, index: Int): T?

Obtain a result from a given ResultSet by index.

open fun getResult(rs: ResultSet, columnLabel: String): T?

Obtain a result from a given ResultSet by columnLabel.

hashCode

open fun hashCode(): Int

Return a hash code value for this SQL type.

setParameter

open fun setParameter(
    ps: PreparedStatement,
    index: Int,
    parameter: T?
): Unit

Set the nullable parameter to a given PreparedStatement.

transform

open fun <R : Any> transform(
    fromUnderlyingValue: (T) -> R,
    toUnderlyingValue: (R) -> T
): SqlType<R>

Transform this SqlType to another. The returned SqlType has the same typeCode and typeName as the
underlying one, and performs the specific transformations on column values.