Package-level declarations

Types

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

Bulk insert expression, represents a bulk insert statement in MySQL.

DSL builder for bulk insert or update on duplicate key clause.

Link copied to clipboard

DSL builder for bulk insert or update statements.

Link copied to clipboard
open class BulkInsertStatementBuilder<T : BaseTable<*>>(table: T)

DSL builder for bulk insert statements.

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

Default value expression, translated to the default keyword in MySQL, used in insert statements.

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

Insert or update expression, represents an insert statement with an on duplicate key update clause in MySQL.

Link copied to clipboard

DSL builder for insert or update statements.

Link copied to clipboard
data class LockingClause(val mode: LockingMode, val tables: List<TableExpression>, val wait: LockingWait)

MySQL locking clause, See https://dev.mysql.com/doc/refman/8.0/en/innodb-locking-reads.html

Link copied to clipboard

MySQL locking mode.

Link copied to clipboard

MySQL wait strategy for locked records.

Link copied to clipboard
data class MatchAgainstExpression(val matchColumns: List<ColumnExpression<*>>, val searchString: String, val searchModifier: SearchModifier? = null, val sqlType: SqlType<Boolean> = BooleanSqlType, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : ScalarExpression<Boolean>

Match against expression, represents an match ... against ... operation in MySQL. See https://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html

Link copied to clipboard

Intermediate class that wraps the search columns of a MatchAgainstExpression.

Link copied to clipboard

Base class of MySQL DSL builders, provide basic functions used to build assignments for insert or update DSL.

Link copied to clipboard

SqlDialect implementation for MySQL database.

Link copied to clipboard

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

Link copied to clipboard
open class MySqlFormatter(database: Database, beautifySql: Boolean, indentSize: Int) : SqlFormatter, MySqlExpressionVisitor

SqlFormatter implementation for MySQL, formatting SQL expressions as strings with their execution arguments.

Link copied to clipboard
data class NaturalJoinExpression(val left: QuerySourceExpression, val right: QuerySourceExpression, val isLeafNode: Boolean = false, val extraProperties: Map<String, Any> = emptyMap()) : QuerySourceExpression

MySQL natural join expression.

Link copied to clipboard

Enum class represents search modifiers in MySQL match ... against ... expressions. See https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html

Functions

Link copied to clipboard
fun MatchColumns.against(searchString: String, modifier: SearchModifier? = null): MatchAgainstExpression

Create a MatchAgainstExpression that searches on the current MatchColumns. Translated to match (col1, col2) against (searchString modifier) in SQL.

Link copied to clipboard
fun <T : BaseTable<*>> Database.bulkInsert(table: T, block: BulkInsertStatementBuilder<T>.() -> Unit): Int

Construct a bulk insert expression in the given closure, then execute it and return the effected row count.

Link copied to clipboard

Bulk insert records to the table, determining if there is a key conflict while inserting each of them, and automatically performs updates if any conflict exists.

Link copied to clipboard

MySQL datediff function, translated to datediff(left, right).

Link copied to clipboard

Return a default value for this column, see DefaultValueExpression.

Link copied to clipboard

MySQL greatest function, translated to greatest(column1, column2, ...).

MySQL greatest function, translated to greatest(left, right).

Link copied to clipboard
fun <T : Any> IF(condition: ColumnDeclaring<Boolean>, then: ColumnDeclaring<T>, otherwise: ColumnDeclaring<T>): FunctionExpression<T>
inline fun <T : Any> IF(condition: ColumnDeclaring<Boolean>, then: T, otherwise: T, sqlType: SqlType<T> = SqlType.of() ?: error("Cannot detect the param's SqlType, please specify manually.")): FunctionExpression<T>

MySQL if function, translated to if(condition, then, otherwise).

Link copied to clipboard

MySQL ifnull function, translated to ifnull(left, right).

Link copied to clipboard

Insert a record to the table, determining if there is a key conflict while it's being inserted, and automatically performs an update if any conflict exists.

Link copied to clipboard
inline fun <T : Any> Column<List<T>>.jsonContains(item: T, sqlType: SqlType<T> = SqlType.of() ?: error("Cannot detect the item's SqlType, please specify manually.")): FunctionExpression<Boolean>

MySQL json_contains function, translated to json_contains(column, json_array(item)).

Link copied to clipboard
inline fun <T : Any> Column<*>.jsonExtract(path: String, sqlType: SqlType<T> = SqlType.of() ?: error("Cannot detect the result's SqlType, please specify manually.")): FunctionExpression<T>

MySQL json_extract function, translated to json_extract(column, path).

Link copied to clipboard
fun <T : Comparable<T>> least(vararg columns: ColumnDeclaring<T>): FunctionExpression<T>

MySQL least function, translated to least(column1, column2, ...).

MySQL least function, translated to least(left, right).

Link copied to clipboard
fun Query.locking(mode: LockingMode, tables: List<BaseTable<*>> = emptyList(), wait: LockingWait = WAIT): Query
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.locking(mode: LockingMode, tables: List<BaseTable<*>> = emptyList(), wait: LockingWait = WAIT): EntitySequence<E, T>

Specify the locking clause of this query, an example generated SQL could be:

Link copied to clipboard
fun match(vararg columns: Column<*>): MatchColumns

Return an intermediate object that wraps the columns to be searched. We can continue to call against on the returned object to create a MatchAgainstExpression that searches the wrapped columns.

Link copied to clipboard

Join the right table and return a new QuerySource, translated to natural join in SQL.

Link copied to clipboard

MySQL rand function, translated to rand().

Link copied to clipboard

MySQL replace function, translated to replace(str, oldValue, newValue).

Link copied to clipboard

MySQL lower function, translated to lower(str).

Link copied to clipboard

MySQL upper function, translated to upper(str).