Package-level declarations

Types

Link copied to clipboard
data class AggregateExpression<T : Any>(val type: AggregateType, val argument: ScalarExpression<*>?, val isDistinct: Boolean = false, val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Aggregate expression.

Link copied to clipboard

The enum of aggregate functions in a AggregateExpression.

Link copied to clipboard
data class ArgumentExpression<T : Any>(val value: T?, val sqlType: SqlType<T>, val isLeafNode: Boolean = true, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Argument expression, wraps an argument passed to the executed SQL.

Link copied to clipboard
data class BetweenExpression(val expression: ScalarExpression<*>, val lower: ScalarExpression<*>, val upper: ScalarExpression<*>, val notBetween: Boolean = false, val sqlType: SqlType<Boolean> = BooleanSqlType, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<Boolean>

Between expression, check if a scalar expression is in the given range.

Link copied to clipboard
data class BinaryExpression<T : Any>(val type: BinaryExpressionType, val left: ScalarExpression<*>, val right: ScalarExpression<*>, val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Binary expression.

Link copied to clipboard

Enum for binary expressions.

Link copied to clipboard
data class CaseWhenExpression<T : Any>(val operand: ScalarExpression<*>?, val whenClauses: List<Pair<ScalarExpression<*>, ScalarExpression<T>>>, val elseClause: ScalarExpression<T>?, val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Case-when expression, represents a SQL case-when clause.

Link copied to clipboard
data class CastingExpression<T : Any>(val expression: SqlExpression, val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Wrap a SQL expression, changing its return type, translated to SQl cast(expr as type).

Link copied to clipboard
data class ColumnAssignmentExpression<T : Any>(val column: ColumnExpression<T>, val expression: ScalarExpression<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Column assignment expression, represents a column assignment for insert or update statements.

Link copied to clipboard
data class ColumnDeclaringExpression<T : Any>(val expression: ScalarExpression<T>, val declaredName: String? = null, val sqlType: SqlType<T> = expression.sqlType, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Column declaring expression, represents the selected columns in a SelectExpression.

Link copied to clipboard
data class ColumnExpression<T : Any>(val table: TableExpression?, val name: String, val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Column expression.

Link copied to clipboard
data class DeleteExpression(val table: TableExpression, val where: ScalarExpression<Boolean>?, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Delete expression, represents the delete statement in SQL.

Link copied to clipboard
data class ExistsExpression(val query: QueryExpression, val notExists: Boolean = false, val sqlType: SqlType<Boolean> = BooleanSqlType, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<Boolean>

Exists expression, check if the specific query has at least one result.

Link copied to clipboard
data class FunctionExpression<T : Any>(val functionName: String, val arguments: List<ScalarExpression<*>>, val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Function expression, represents a normal SQL function call.

Link copied to clipboard
data class InListExpression(val left: ScalarExpression<*>, val query: QueryExpression? = null, val values: List<ScalarExpression<*>>? = null, val notInList: Boolean = false, val sqlType: SqlType<Boolean> = BooleanSqlType, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<Boolean>

In-list expression, translated to the in keyword in SQL.

Link copied to clipboard
data class InsertExpression(val table: TableExpression, val assignments: List<ColumnAssignmentExpression<*>>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Insert expression, represents the insert statement in SQL.

Link copied to clipboard
data class InsertFromQueryExpression(val table: TableExpression, val columns: List<ColumnExpression<*>>, val query: QueryExpression, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Insert-from-query expression, e.g. insert into tmp(num) select 1 from dual.

Link copied to clipboard
data class JoinExpression(val type: JoinType, val left: QuerySourceExpression, val right: QuerySourceExpression, val condition: ScalarExpression<Boolean>? = null, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : QuerySourceExpression

Join expression.

Link copied to clipboard

The enum of joining types in a JoinExpression.

Link copied to clipboard
data class OrderByExpression(val expression: ScalarExpression<*>, val orderType: OrderType, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Order-by expression.

Link copied to clipboard

The enum of order directions in a OrderByExpression.

Link copied to clipboard

Base class of query expressions, provide common properties for SelectExpression and UnionExpression.

Link copied to clipboard

Query source expression, used in the from clause of a SelectExpression.

Link copied to clipboard

Base class of scalar expressions. An expression is "scalar" if it has a return value (e.g. a + 1).

Link copied to clipboard
data class SelectExpression(val columns: List<ColumnDeclaringExpression<*>> = emptyList(), val from: QuerySourceExpression, val where: ScalarExpression<Boolean>? = null, val groupBy: List<ScalarExpression<*>> = emptyList(), val having: ScalarExpression<Boolean>? = null, val isDistinct: Boolean = false, val orderBy: List<OrderByExpression> = emptyList(), val offset: Int? = null, val limit: Int? = null, val tableAlias: String? = null, val extraProperties: Map<String, Any> = emptyMap()) : QueryExpression

Select expression, represents a select statement of SQL.

Link copied to clipboard
abstract class SqlExpression

Root class of SQL expressions or statements.

Link copied to clipboard

Base interface designed to visit or modify SQL expression trees using visitor pattern.

Link copied to clipboard

Interceptor that can intercept the visit functions for SqlExpressionVisitor and its sub-interfaces.

Link copied to clipboard
abstract class SqlFormatter(val database: Database, val beautifySql: Boolean, val indentSize: Int) : SqlExpressionVisitor

Implementation of SqlExpressionVisitor, visiting SQL expression trees using visitor pattern. After a visit completes, the executable SQL string will be generated in the sql property with its execution parameters in parameters.

Link copied to clipboard
data class TableExpression(val name: String, val tableAlias: String? = null, val catalog: String? = null, val schema: String? = null, val isLeafNode: Boolean = true, val extraProperties: Map<String, Any> = emptyMap()) : QuerySourceExpression

Table expression.

Link copied to clipboard
data class UnaryExpression<T : Any>(val type: UnaryExpressionType, val operand: ScalarExpression<*>, val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Unary expression.

Link copied to clipboard

Enum for unary expressions.

Link copied to clipboard
data class UnionExpression(val left: QueryExpression, val right: QueryExpression, val isUnionAll: Boolean, val orderBy: List<OrderByExpression> = emptyList(), val offset: Int? = null, val limit: Int? = null, val tableAlias: String? = null, val extraProperties: Map<String, Any> = emptyMap()) : QueryExpression

Union expression, represents a union statement of SQL.

Link copied to clipboard
data class UpdateExpression(val table: TableExpression, val assignments: List<ColumnAssignmentExpression<*>>, val where: ScalarExpression<Boolean>? = null, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Update expression, represents the update statement in SQL.

Link copied to clipboard
data class WindowFrameBoundExpression(val type: WindowFrameBoundType, val argument: ScalarExpression<*>?, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Window frame bound expression.

Link copied to clipboard

The enum type of window frame bound.

Link copied to clipboard

The enum type of window frame unit.

Link copied to clipboard
data class WindowFunctionExpression<T : Any>(val type: WindowFunctionType, val arguments: List<ScalarExpression<*>>, val isDistinct: Boolean = false, val window: WindowSpecificationExpression = WindowSpecificationExpression(), val sqlType: SqlType<T>, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<T>

Window function expression, represents a SQL window function call.

Link copied to clipboard

The enum of window function type.

Link copied to clipboard
data class WindowSpecificationExpression(val partitionBy: List<ScalarExpression<*>> = emptyList(), val orderBy: List<OrderByExpression> = emptyList(), val frameUnit: WindowFrameUnitType? = null, val frameStart: WindowFrameBoundExpression? = null, val frameEnd: WindowFrameBoundExpression? = null, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : SqlExpression

Window specification expression.

Functions

Link copied to clipboard

Create a default visitor instance for this interface using the specific interceptor.