# Package-level declarations

## Types

Contains
Link copied to clipboard
class Contains(val target: Expression<*>, val candidate: Expression<*>, val path: String?, val jsonType: IColumnType<*>) : Op<Boolean> , ComplexExpression

Represents an SQL operator that checks whether a candidate expression is contained within a JSON target.

Exists
Link copied to clipboard
class Exists(val expression: Expression<*>, val path: String, val optional: String?, val jsonType: IColumnType<*>) : Op<Boolean> , ComplexExpression

Represents an SQL operator that checks whether data exists within a JSON expression at the specified path.

Extract
Link copied to clipboard
class Extract<T>(val expression: Expression<*>, val path: String, val toScalar: Boolean, val jsonType: IColumnType<*>, columnType: IColumnType<T & Any>) : Function<T>

Represents an SQL function that returns extracted data from a JSON object at the specified path, either as a JSON representation or as a scalar value.

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

Column for storing JSON data in binary format.

JsonColumnType
Link copied to clipboard
open class JsonColumnType<T : Any>(val serialize: (T) -> String, val deserialize: (String) -> T) : ColumnType<T> , JsonColumnMarker

Column for storing JSON data, either in non-binary text format or the vendor's default JSON type format.

## Functions

castToJson
Link copied to clipboard
inline fun <T : Any> ExpressionWithColumnType<*>.castToJson(): CastToJson<T>

Specifies a casting of the calling expression's data type to the JSON data type. This is useful when it may be necessary to cast a type such as text to a JSON type that can be handled by a serializable class on the client-side.

@JvmName(name = "castToJsonReceiverType")
inline fun <T : Any, E : T?> ExpressionWithColumnType<E>.castToJson(): CastToJson<E>

Specifies a casting of the calling expression's data type to the JSON data type. This is useful when it may be necessary to cast a JSONB column or expression to JSON, but some dialects also support casting text types as well.

contains
Link copied to clipboard
fun <T> ExpressionWithColumnType<*>.contains(candidate: T, path: String? = null): Contains

Checks whether a candidate value is contained within this JSON expression.

fun ExpressionWithColumnType<*>.contains(candidate: Expression<*>, path: String? = null): Contains

Checks whether a candidate expression is contained within this JSON expression.

exists
Link copied to clipboard
fun ExpressionWithColumnType<*>.exists(vararg path: String, optional: String? = null): Exists

Checks whether data exists within this JSON expression at the specified path.

extract
Link copied to clipboard
inline fun <T : Any> ExpressionWithColumnType<*>.extract(vararg path: String, toScalar: Boolean = true): Extract<T>

Returns the extracted data from a JSON object at the specified path, either as a JSON representation or as a scalar value.

json
Link copied to clipboard
fun <T : Any> Table.json(name: String, serialize: (T) -> String, deserialize: (String) -> T): Column<T>
inline fun <T : Any> Table.json(name: String, jsonConfig: Json, kSerializer: KSerializer<T> = serializer<T>()): Column<T>

Creates a column, with the specified name, for storing JSON data.

jsonb
Link copied to clipboard
fun <T : Any> Table.jsonb(name: String, serialize: (T) -> String, deserialize: (String) -> T, castToJsonFormat: Boolean = true): Column<T>
inline fun <T : Any> Table.jsonb(name: String, jsonConfig: Json, kSerializer: KSerializer<T> = serializer<T>(), castToJsonFormat: Boolean = true): Column<T>

Creates a column, with the specified name, for storing JSON data in decomposed binary format.