Back to Exposed

Extract

docs/api/exposed-json/org.jetbrains.exposed.v1.json/-extract/index.html

1.2.08.4 KB
Original Source

Extract

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.

MembersMembers & Extensions

Constructors

Extract

Link copied to clipboard

constructor(expression: Expression<*>, vararg path: String, toScalar: Boolean, jsonType: IColumnType<*>, columnType: IColumnType<T & Any>)

Properties

columnType

Link copied to clipboard

open override val columnType: IColumnType<T & Any>

expression

Link copied to clipboard

val expression: Expression<*>

The expression from which to extract JSON subcomponents matched by path.

jsonType

Link copied to clipboard

val jsonType: IColumnType<*>

The column type of expression to check, if casting to JSONB is required.

path

Link copied to clipboard

val path: Array<out String>

Array of Strings representing JSON path/keys that match fields to be extracted.

toScalar

Link copied to clipboard

val toScalar: Boolean

Whether the extracted result should be a scalar or text value; if false, result will be a JSON object.

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.

equals

Link copied to clipboard

open operator override fun equals(other: Any?): Boolean

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.

hashCode

Link copied to clipboard

open override fun hashCode(): Int

toQueryBuilder

Link copied to clipboard

open override fun toQueryBuilder(queryBuilder: QueryBuilder)

toString

Link copied to clipboard

open override fun toString(): String

Generated by Dokka © 2026 Copyright