# JsonBColumnType

class JsonBColumnType<T : Any>(serialize: (T) -> String, deserialize: (String) -> T, castToJsonFormat: Boolean = false) : JsonColumnType<T>

Column for storing JSON data in binary format.

#### Parameters

serialize

Function that encodes an object of type T to a JSON String

deserialize

Function that decodes a JSON String to an object of type T

castToJsonFormat

Whether reads from this column should cast retrieved data to a non-binary format. This value only applies to SQLite databases & will be ignored for all others.

#### Samples

jsonb

## Constructors

JsonBColumnType
Link copied to clipboard
constructor(serialize: (T) -> String, deserialize: (String) -> T, castToJsonFormat: Boolean = false)

## Properties

deserialize
Link copied to clipboard
val deserialize: (String) -> T

Decode a JSON String to an object of type T.

needsBinaryFormatCast
Link copied to clipboard
open override val needsBinaryFormatCast: Boolean
nullable
Link copied to clipboard
open override var nullable: Boolean
serialize
Link copied to clipboard
val serialize: (T) -> String

Encode an object of type T to a JSON String.

usesBinaryFormat
Link copied to clipboard
open override val usesBinaryFormat: Boolean = true

## Functions

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
nonNullValueAsDefaultString
Link copied to clipboard
open override fun nonNullValueAsDefaultString(value: T): String
nonNullValueToString
Link copied to clipboard
open override fun nonNullValueToString(value: T): String
notNullValueToDB
Link copied to clipboard
open override fun notNullValueToDB(value: T): Any
parameterMarker
Link copied to clipboard
open override fun parameterMarker(value: T?): String
readObject
Link copied to clipboard
open override fun readObject(rs: RowApi, index: Int): Any?
setParameter
Link copied to clipboard
open override fun setParameter(stmt: PreparedStatementApi, index: Int, value: Any?)
sqlType
Link copied to clipboard
open override fun sqlType(): String
toString
Link copied to clipboard
open override fun toString(): String
validateValueBeforeUpdate
Link copied to clipboard
open fun validateValueBeforeUpdate(value: T?)
valueAsDefaultString
Link copied to clipboard
open fun valueAsDefaultString(value: T?): String
valueFromDB
Link copied to clipboard
open override fun valueFromDB(value: Any): T
valueToDB
Link copied to clipboard
open fun valueToDB(value: T?): Any?
valueToString
Link copied to clipboard
open override fun valueToString(value: T?): String