Package-level declarations

Types

Link copied to clipboard
interface Entity<E : Entity<E>> : Serializable

The super interface of all entity classes in Ktorm. This interface injects many useful functions into entities.

Link copied to clipboard

Entity extension APIs.

Link copied to clipboard
class EntityGrouping<E : Any, T : BaseTable<E>, K : Any>(val sequence: EntitySequence<E, T>, val keySelector: (T) -> ColumnDeclaring<K>)

Wraps an EntitySequence with a keySelector function, which can be applied to each record to get its key, or used as the group by clause of the generated SQL.

Link copied to clipboard
class EntitySequence<E : Any, T : BaseTable<E>>(val database: Database, val sourceTable: T, val expression: SelectExpression, val entityExtractor: (row: QueryRowSet) -> E)

Represents a sequence of entity objects. As the name implies, the style and use pattern of Ktorm's entity sequence APIs are highly similar to kotlin.sequences.Sequence and the extension functions in Kotlin standard lib, as it provides many extension functions with the same names, such as filter, map, reduce, etc.

Link copied to clipboard
typealias Tuple2<E1, E2> = Pair<E1, E2>

Set a typealias Tuple2 for Pair.

Link copied to clipboard
typealias Tuple3<E1, E2, E3> = Triple<E1, E2, E3>

Set a typealias Tuple3 for Triple.

Link copied to clipboard
data class Tuple4<out E1, out E2, out E3, out E4>(val element1: E1, val element2: E2, val element3: E3, val element4: E4) : Serializable

Represents a tuple of 4 values.

Link copied to clipboard
data class Tuple5<out E1, out E2, out E3, out E4, out E5>(val element1: E1, val element2: E2, val element3: E3, val element4: E4, val element5: E5) : Serializable

Represents a tuple of 5 values.

Link copied to clipboard
data class Tuple6<out E1, out E2, out E3, out E4, out E5, out E6>(val element1: E1, val element2: E2, val element3: E3, val element4: E4, val element5: E5, val element6: E6) : Serializable

Represents a tuple of 6 values.

Link copied to clipboard
data class Tuple7<out E1, out E2, out E3, out E4, out E5, out E6, out E7>(val element1: E1, val element2: E2, val element3: E3, val element4: E4, val element5: E5, val element6: E6, val element7: E7) : Serializable

Represents a tuple of 7 values.

Link copied to clipboard
data class Tuple8<out E1, out E2, out E3, out E4, out E5, out E6, out E7, out E8>(val element1: E1, val element2: E2, val element3: E3, val element4: E4, val element5: E5, val element6: E6, val element7: E7, val element8: E8) : Serializable

Represents a tuple of 8 values.

Link copied to clipboard
data class Tuple9<out E1, out E2, out E3, out E4, out E5, out E6, out E7, out E8, out E9>(val element1: E1, val element2: E2, val element3: E3, val element4: E4, val element5: E5, val element6: E6, val element7: E7, val element8: E8, val element9: E9) : Serializable

Represents a tuple of 9 values.

Functions

Link copied to clipboard
fun <E : Entity<E>, T : Table<E>> EntitySequence<E, T>.add(entity: E): Int

Insert the given entity into the table and return the affected record number.

Link copied to clipboard
inline fun <E : Any, K : Any, R> EntityGrouping<E, *, K>.aggregate(operation: (key: K?, accumulator: R?, element: E, first: Boolean) -> R): Map<K?, R>

Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in a new map.

Link copied to clipboard
@JvmName(name = "_aggregateColumns2")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): Map<K?, Tuple2<C1?, C2?>>
@JvmName(name = "_aggregateColumns3")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): Map<K?, Tuple3<C1?, C2?, C3?>>
@JvmName(name = "_aggregateColumns4")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): Map<K?, Tuple4<C1?, C2?, C3?, C4?>>
@JvmName(name = "_aggregateColumns5")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): Map<K?, Tuple5<C1?, C2?, C3?, C4?, C5?>>
@JvmName(name = "_aggregateColumns6")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): Map<K?, Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>>
@JvmName(name = "_aggregateColumns7")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): Map<K?, Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>>
@JvmName(name = "_aggregateColumns8")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): Map<K?, Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>>
@JvmName(name = "_aggregateColumns9")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, C9 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): Map<K?, Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>>

Group elements from the source sequence by key and perform the given aggregations for elements in each group, then store the results in a new Map.

inline fun <E : Any, T : BaseTable<E>, K : Any, C : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> ColumnDeclaring<C>): Map<K?, C?>

Group elements from the source sequence by key and perform the given aggregation for elements in each group, then store the results in a new Map.

@JvmName(name = "_aggregateColumns2")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): Tuple2<C1?, C2?>
@JvmName(name = "_aggregateColumns3")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): Tuple3<C1?, C2?, C3?>
@JvmName(name = "_aggregateColumns4")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): Tuple4<C1?, C2?, C3?, C4?>
@JvmName(name = "_aggregateColumns5")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): Tuple5<C1?, C2?, C3?, C4?, C5?>
@JvmName(name = "_aggregateColumns6")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>
@JvmName(name = "_aggregateColumns7")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>
@JvmName(name = "_aggregateColumns8")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>
@JvmName(name = "_aggregateColumns9")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, C9 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>

Perform a tuple of aggregations given by aggregationSelector for all elements in the sequence, and return the aggregate results.

inline fun <E : Any, T : BaseTable<E>, C : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> ColumnDeclaring<C>): C?

Perform an aggregation given by aggregationSelector for all elements in the sequence, and return the aggregate result.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, C : Any, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> ColumnDeclaring<C>): M

Group elements from the source sequence by key and perform the given aggregation for elements in each group, then store the results in the destination map.

@JvmName(name = "_aggregateColumns2To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, M : MutableMap<in K?, in Tuple2<C1?, C2?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): M
@JvmName(name = "_aggregateColumns3To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, M : MutableMap<in K?, in Tuple3<C1?, C2?, C3?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): M
@JvmName(name = "_aggregateColumns4To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, M : MutableMap<in K?, in Tuple4<C1?, C2?, C3?, C4?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): M
@JvmName(name = "_aggregateColumns5To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, M : MutableMap<in K?, in Tuple5<C1?, C2?, C3?, C4?, C5?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): M
@JvmName(name = "_aggregateColumns6To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, M : MutableMap<in K?, in Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): M
@JvmName(name = "_aggregateColumns7To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, M : MutableMap<in K?, in Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): M
@JvmName(name = "_aggregateColumns8To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, M : MutableMap<in K?, in Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): M
@JvmName(name = "_aggregateColumns9To")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, C9 : Any, M : MutableMap<in K?, in Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>>> EntityGrouping<E, T, K>.aggregateColumnsTo(destination: M, aggregationSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): M

Group elements from the source sequence by key and perform the given aggregations for elements in each group, then store the results in the destination map.

Link copied to clipboard
inline fun <E : Any, K : Any, R, M : MutableMap<in K?, R>> EntityGrouping<E, *, K>.aggregateTo(destination: M, operation: (key: K?, accumulator: R?, element: E, first: Boolean) -> R): M

Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.all(predicate: (T) -> ColumnDeclaring<Boolean>): Boolean

Return true if all elements match the given predicate.

Link copied to clipboard

Return true if the sequence has at lease one element.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.any(predicate: (T) -> ColumnDeclaring<Boolean>): Boolean

Return true if at least one element matches the given predicate.

Link copied to clipboard
inline fun <E : Any, K, V> EntitySequence<E, *>.associate(transform: (E) -> Pair<K, V>): Map<K, V>

Return a Map containing key-value pairs provided by transform function applied to elements of the given sequence.

Link copied to clipboard
inline fun <E : Any, K> EntitySequence<E, *>.associateBy(keySelector: (E) -> K): Map<K, E>

Return a Map containing the elements from the given sequence indexed by the key returned from keySelector function applied to each element.

inline fun <E : Any, K, V> EntitySequence<E, *>.associateBy(keySelector: (E) -> K, valueTransform: (E) -> V): Map<K, V>

Return a Map containing the values provided by valueTransform and indexed by keySelector functions applied to elements of the given sequence.

Link copied to clipboard
inline fun <E : Any, K, M : MutableMap<in K, in E>> EntitySequence<E, *>.associateByTo(destination: M, keySelector: (E) -> K): M

Populate and return the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each element of the given sequence and value is the element itself.

inline fun <E : Any, K, V, M : MutableMap<in K, in V>> EntitySequence<E, *>.associateByTo(destination: M, keySelector: (E) -> K, valueTransform: (E) -> V): M

Populate and return the destination mutable map with key-value pairs, where key is provided by the keySelector function and value is provided by the valueTransform function applied to elements of the given sequence.

Link copied to clipboard
inline fun <E : Any, K, V, M : MutableMap<in K, in V>> EntitySequence<E, *>.associateTo(destination: M, transform: (E) -> Pair<K, V>): M

Populate and return the destination mutable map with key-value pairs provided by transform function applied to each element of the given sequence.

Link copied to clipboard
inline fun <K : Entity<K>, V> EntitySequence<K, *>.associateWith(valueSelector: (K) -> V): Map<K, V>

Return a Map where keys are elements from the given sequence and values are produced by the valueSelector function applied to each element.

Link copied to clipboard
inline fun <K : Entity<K>, V, M : MutableMap<in K, in V>> EntitySequence<K, *>.associateWithTo(destination: M, valueSelector: (K) -> V): M

Populate and return the destination mutable map with key-value pairs for each element of the given sequence, where key is the element itself and value is provided by the valueSelector function applied to that key.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.averageBy(selector: (T) -> ColumnDeclaring<out Number>): Double?

Return the average value of the column given by selector in this sequence.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.clear(): Int

Remove all the elements of this sequence. The sequence will be empty after this function returns.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.count(): Int

Return the number of elements in this sequence.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.count(predicate: (T) -> ColumnDeclaring<Boolean>): Int

Return the number of elements matching the given predicate.

Link copied to clipboard

Returns a sequence containing all elements except first n elements.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any> EntityGrouping<E, T, K>.eachAverageBy(columnSelector: (T) -> ColumnDeclaring<out Number>): Map<K?, Double?>

Group elements from the source sequence by key and average the columns or expressions provided by the columnSelector function for elements in each group.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, M : MutableMap<in K?, in Double?>> EntityGrouping<E, T, K>.eachAverageByTo(destination: M, columnSelector: (T) -> ColumnDeclaring<out Number>): M

Group elements from the source sequence by key and average the columns or expressions provided by the columnSelector function for elements in each group, then store the results in the destination map.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>, K : Any> EntityGrouping<E, T, K>.eachCount(): Map<K?, Int>

Group elements from the source sequence by key and count elements in each group.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>, K : Any, M : MutableMap<in K?, Int>> EntityGrouping<E, T, K>.eachCountTo(destination: M): M

Group elements from the source sequence by key and count elements in each group, then store the results in the destination map.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>> EntityGrouping<E, T, K>.eachMaxBy(columnSelector: (T) -> ColumnDeclaring<C>): Map<K?, C?>

Group elements from the source sequence by key and get the max value of the columns or expressions provided by the columnSelector function for elements in each group.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.eachMaxByTo(destination: M, columnSelector: (T) -> ColumnDeclaring<C>): M

Group elements from the source sequence by key and get the max value of the columns or expressions provided by the columnSelector function for elements in each group, then store the results in the destination map.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>> EntityGrouping<E, T, K>.eachMinBy(columnSelector: (T) -> ColumnDeclaring<C>): Map<K?, C?>

Group elements from the source sequence by key and get the min value of the columns or expressions provided by the columnSelector function for elements in each group.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.eachMinByTo(destination: M, columnSelector: (T) -> ColumnDeclaring<C>): M

Group elements from the source sequence by key and get the min value of the columns or expressions provided by the columnSelector function for elements in each group, then store the results in the destination map.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, C : Number> EntityGrouping<E, T, K>.eachSumBy(columnSelector: (T) -> ColumnDeclaring<C>): Map<K?, C?>

Group elements from the source sequence by key and sum the columns or expressions provided by the columnSelector function for elements in each group.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, K : Any, C : Number, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.eachSumByTo(destination: M, columnSelector: (T) -> ColumnDeclaring<C>): M

Group elements from the source sequence by key and sum the columns or expressions provided by the columnSelector function for elements in each group, then store the results in the destination map.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.elementAt(index: Int): E

Return an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this sequence.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.elementAtOrElse(index: Int, defaultValue: (Int) -> E): E

Return an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this sequence.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.elementAtOrNull(index: Int): E?

Return an element at the given index or null if the index is out of bounds of this sequence.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.filter(predicate: (T) -> ColumnDeclaring<Boolean>): EntitySequence<E, T>

Return a sequence containing only elements matching the given predicate.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.filterColumns(selector: (T) -> List<Column<*>>): EntitySequence<E, T>

Return a sequence customizing the selected columns of the internal query.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.filterNot(predicate: (T) -> ColumnDeclaring<Boolean>): EntitySequence<E, T>

Return a sequence containing only elements not matching the given predicate.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : MutableCollection<in E>> EntitySequence<E, T>.filterNotTo(destination: C, predicate: (T) -> ColumnDeclaring<Boolean>): C

Append all elements not matching the given predicate to the given destination.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : MutableCollection<in E>> EntitySequence<E, T>.filterTo(destination: C, predicate: (T) -> ColumnDeclaring<Boolean>): C

Append all elements matching the given predicate to the given destination.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.find(predicate: (T) -> ColumnDeclaring<Boolean>): E?

Return the first element matching the given predicate, or null if no such element was found.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.findLast(predicate: (T) -> ColumnDeclaring<Boolean>): E?

Return the last element matching the given predicate, or null if no such element was found.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.first(): E

Return the first element, or throws NoSuchElementException if the sequence is empty.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.first(predicate: (T) -> ColumnDeclaring<Boolean>): E

Return the first element matching the given predicate, or throws NoSuchElementException if element was not found.

Link copied to clipboard

Return the first element, or null if the sequence is empty.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.firstOrNull(predicate: (T) -> ColumnDeclaring<Boolean>): E?

Return the first element matching the given predicate, or null if element was not found.

Link copied to clipboard
inline fun <E : Any, R> EntitySequence<E, *>.flatMap(transform: (E) -> Iterable<R>): List<R>

Return a single list of all elements yielded from results of transform function being invoked on each element of original sequence.

Link copied to clipboard
inline fun <E : Any, R> EntitySequence<E, *>.flatMapIndexed(transform: (index: Int, E) -> Iterable<R>): List<R>

Return a single list of all elements yielded from results of transform function being invoked on each element and its index in the original sequence.

Link copied to clipboard
inline fun <E : Any, R, C : MutableCollection<in R>> EntitySequence<E, *>.flatMapIndexedTo(destination: C, transform: (index: Int, E) -> Iterable<R>): C

Append all elements yielded from results of transform function being invoked on each element and its index in the original sequence, to the given destination.

Link copied to clipboard
inline fun <E : Any, R, C : MutableCollection<in R>> EntitySequence<E, *>.flatMapTo(destination: C, transform: (E) -> Iterable<R>): C

Append all elements yielded from results of transform function being invoked on each element of original sequence, to the given destination.

Link copied to clipboard
inline fun <E : Any, K : Any, R> EntityGrouping<E, *, K>.fold(initialValue: R, operation: (accumulator: R, element: E) -> R): Map<K?, R>

Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in a new map. An initial value of accumulator is the same initialValue for each group.

inline fun <E : Any, K : Any, R> EntityGrouping<E, *, K>.fold(initialValueSelector: (key: K?, element: E) -> R, operation: (key: K?, accumulator: R, element: E) -> R): Map<K?, R>

Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in a new map. An initial value of accumulator is provided by initialValueSelector function.

inline fun <E : Any, R> EntitySequence<E, *>.fold(initial: R, operation: (acc: R, E) -> R): R

Accumulate value starting with initial value and applying operation from left to right to current accumulator value and each element.

Link copied to clipboard
inline fun <E : Any, R> EntitySequence<E, *>.foldIndexed(initial: R, operation: (index: Int, acc: R, E) -> R): R

Accumulate value starting with initial value and applying operation from left to right to current accumulator value and each element with its index in the original sequence.

Link copied to clipboard
inline fun <E : Any, K : Any, R, M : MutableMap<in K?, R>> EntityGrouping<E, *, K>.foldTo(destination: M, initialValue: R, operation: (accumulator: R, element: E) -> R): M

Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map. An initial value of accumulator is the same initialValue for each group.

inline fun <E : Any, K : Any, R, M : MutableMap<in K?, R>> EntityGrouping<E, *, K>.foldTo(destination: M, initialValueSelector: (key: K?, element: E) -> R, operation: (key: K?, accumulator: R, element: E) -> R): M

Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map. An initial value of accumulator is provided by initialValueSelector function.

Link copied to clipboard
inline fun <E : Any> EntitySequence<E, *>.forEach(action: (E) -> Unit)

Perform the given action on each element.

Link copied to clipboard
inline fun <E : Any> EntitySequence<E, *>.forEachIndexed(action: (index: Int, E) -> Unit)

Perform the given action on each element, providing sequential index with the element.

Link copied to clipboard
inline fun <E : Any, K> EntitySequence<E, *>.groupBy(keySelector: (E) -> K): Map<K, List<E>>

Group elements of the original sequence by the key returned by the given keySelector function applied to each element and return a map where each group key is associated with a list of corresponding elements.

inline fun <E : Any, K, V> EntitySequence<E, *>.groupBy(keySelector: (E) -> K, valueTransform: (E) -> V): Map<K, List<V>>

Group values returned by the valueTransform function applied to each element of the original sequence by the key returned by the given keySelector function applied to the element and returns a map where each group key is associated with a list of corresponding values.

Link copied to clipboard
inline fun <E : Any, K, M : MutableMap<in K, MutableList<E>>> EntitySequence<E, *>.groupByTo(destination: M, keySelector: (E) -> K): M

Group elements of the original sequence by the key returned by the given keySelector function applied to each element and put to the destination map each group key associated with a list of corresponding elements.

inline fun <E : Any, K, V, M : MutableMap<in K, MutableList<V>>> EntitySequence<E, *>.groupByTo(destination: M, keySelector: (E) -> K, valueTransform: (E) -> V): M

Group values returned by the valueTransform function applied to each element of the original sequence by the key returned by the given keySelector function applied to the element and put to the destination map each group key associated with a list of corresponding values.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>, K : Any> EntitySequence<E, T>.groupingBy(keySelector: (T) -> ColumnDeclaring<K>): EntityGrouping<E, T, K>

Create an EntityGrouping from the sequence to be used later with one of group-and-fold operations.

Link copied to clipboard

Return true if the sequence has no elements.

Link copied to clipboard

Return true if the sequence has at lease one element.

Link copied to clipboard
fun <E : Any, A : Appendable> EntitySequence<E, *>.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (E) -> CharSequence? = null): A

Append the string from all the elements separated using separator and using the given prefix and postfix.

Link copied to clipboard
fun <E : Any> EntitySequence<E, *>.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (E) -> CharSequence? = null): String

Create a string from all the elements separated using separator and using the given prefix and postfix.

Link copied to clipboard
fun <E : Any> EntitySequence<E, *>.last(): E

Return the last element, or throws NoSuchElementException if the sequence is empty.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.last(predicate: (T) -> ColumnDeclaring<Boolean>): E

Return the last element matching the given predicate, or throws NoSuchElementException if no such element found.

Link copied to clipboard
fun <E : Any> EntitySequence<E, *>.lastOrNull(): E?

Return the last element, or null if the sequence is empty.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.lastOrNull(predicate: (T) -> ColumnDeclaring<Boolean>): E?

Return the last element matching the given predicate, or null if no such element was found.

Link copied to clipboard
inline fun <E : Any, R> EntitySequence<E, *>.map(transform: (E) -> R): List<R>

Return a List containing the results of applying the given transform function to each element in the original sequence.

Link copied to clipboard
@JvmName(name = "_mapColumns2")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): List<Tuple2<C1?, C2?>>
@JvmName(name = "_mapColumns3")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): List<Tuple3<C1?, C2?, C3?>>
@JvmName(name = "_mapColumns4")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): List<Tuple4<C1?, C2?, C3?, C4?>>
@JvmName(name = "_mapColumns5")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): List<Tuple5<C1?, C2?, C3?, C4?, C5?>>
@JvmName(name = "_mapColumns6")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): List<Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>>
@JvmName(name = "_mapColumns7")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): List<Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>>
@JvmName(name = "_mapColumns8")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): List<Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>>
@JvmName(name = "_mapColumns9")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, C9 : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): List<Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>>
inline fun <E : Any, T : BaseTable<E>, C : Any> EntitySequence<E, T>.mapColumns(isDistinct: Boolean = false, columnSelector: (T) -> ColumnDeclaring<C>): List<C?>

Customize the selected columns of the internal query by the given columnSelector function, and return a List containing the query results.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : Any> EntitySequence<E, T>.mapColumnsNotNull(isDistinct: Boolean = false, columnSelector: (T) -> ColumnDeclaring<C>): List<C>

Customize the selected columns of the internal query by the given columnSelector function, and return a List containing the non-null results.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : Any, R : MutableCollection<in C>> EntitySequence<E, T>.mapColumnsNotNullTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> ColumnDeclaring<C>): R

Customize the selected columns of the internal query by the given columnSelector function, and append non-null results to the given destination.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : Any, R : MutableCollection<in C?>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> ColumnDeclaring<C>): R
@JvmName(name = "_mapColumns2To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, R : MutableCollection<in Tuple2<C1?, C2?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): R
@JvmName(name = "_mapColumns3To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, R : MutableCollection<in Tuple3<C1?, C2?, C3?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): R
@JvmName(name = "_mapColumns4To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, R : MutableCollection<in Tuple4<C1?, C2?, C3?, C4?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): R
@JvmName(name = "_mapColumns5To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, R : MutableCollection<in Tuple5<C1?, C2?, C3?, C4?, C5?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): R
@JvmName(name = "_mapColumns6To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, R : MutableCollection<in Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): R
@JvmName(name = "_mapColumns7To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, R : MutableCollection<in Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): R
@JvmName(name = "_mapColumns8To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, R : MutableCollection<in Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): R
@JvmName(name = "_mapColumns9To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, C9 : Any, R : MutableCollection<in Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): R

Customize the selected columns of the internal query by the given columnSelector function, and append the query results to the given destination.

Link copied to clipboard
inline fun <E : Any, R> EntitySequence<E, *>.mapIndexed(transform: (index: Int, E) -> R): List<R>

Return a List containing the results of applying the given transform function to each element and its index in the original sequence.

Link copied to clipboard
inline fun <E : Any, R : Any> EntitySequence<E, *>.mapIndexedNotNull(transform: (index: Int, E) -> R?): List<R>

Return a List containing only the non-null results of applying the given transform function to each element and its index in the original sequence.

Link copied to clipboard
inline fun <E : Any, R : Any, C : MutableCollection<in R>> EntitySequence<E, *>.mapIndexedNotNullTo(destination: C, transform: (index: Int, E) -> R?): C

Apply the given transform function to each element and its index in the original sequence and append only the non-null results to the given destination.

Link copied to clipboard
inline fun <E : Any, R, C : MutableCollection<in R>> EntitySequence<E, *>.mapIndexedTo(destination: C, transform: (index: Int, E) -> R): C

Apply the given transform function to each element and its index in the original sequence and append the results to the given destination.

Link copied to clipboard
inline fun <E : Any, R : Any> EntitySequence<E, *>.mapNotNull(transform: (E) -> R?): List<R>

Return a List containing only the non-null results of applying the given transform function to each element in the original sequence.

Link copied to clipboard
inline fun <E : Any, R : Any, C : MutableCollection<in R>> EntitySequence<E, *>.mapNotNullTo(destination: C, transform: (E) -> R?): C

Apply the given transform function to each element in the original sequence and append only the non-null results to the given destination.

Link copied to clipboard
inline fun <E : Any, R, C : MutableCollection<in R>> EntitySequence<E, *>.mapTo(destination: C, transform: (E) -> R): C

Apply the given transform function to each element of the original sequence and append the results to the given destination.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : Comparable<C>> EntitySequence<E, T>.maxBy(selector: (T) -> ColumnDeclaring<C>): C?

Return the max value of the column given by selector in this sequence.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : Comparable<C>> EntitySequence<E, T>.minBy(selector: (T) -> ColumnDeclaring<C>): C?

Return the min value of the column given by selector in this sequence.

Link copied to clipboard

Return true if the sequence has no elements.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.none(predicate: (T) -> ColumnDeclaring<Boolean>): Boolean

Return true if no elements match the given predicate.

Link copied to clipboard
inline fun <E : Any, K : Any> EntityGrouping<E, *, K>.reduce(operation: (key: K?, accumulator: E, element: E) -> E): Map<K?, E>

Groups elements from the source sequence by key and applies the reducing operation to the elements of each group sequentially starting from the second element of the group, passing the previously accumulated value and the current element as arguments, and stores the results in a new map. An initial value of accumulator is the first element of the group.

inline fun <E : Any> EntitySequence<E, *>.reduce(operation: (acc: E, E) -> E): E

Accumulate value starting with the first element and applying operation from left to right to current accumulator value and each element.

Link copied to clipboard
inline fun <E : Any> EntitySequence<E, *>.reduceIndexed(operation: (index: Int, acc: E, E) -> E): E

Accumulate value starting with the first element and applying operation from left to right to current accumulator value and each element with its index in the original sequence.

Link copied to clipboard
inline fun <E : Any> EntitySequence<E, *>.reduceIndexedOrNull(operation: (index: Int, acc: E, E) -> E): E?

Accumulate value starting with the first element and applying operation from left to right to current accumulator value and each element with its index in the original sequence.

Link copied to clipboard
inline fun <E : Any> EntitySequence<E, *>.reduceOrNull(operation: (acc: E, E) -> E): E?

Accumulate value starting with the first element and applying operation from left to right to current accumulator value and each element.

Link copied to clipboard
inline fun <E : Any, K : Any, M : MutableMap<in K?, E>> EntityGrouping<E, *, K>.reduceTo(destination: M, operation: (key: K?, accumulator: E, element: E) -> E): M

Groups elements from the source sequence by key and applies the reducing operation to the elements of each group sequentially starting from the second element of the group, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map. An initial value of accumulator is the first element of the group.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.removeIf(predicate: (T) -> ColumnDeclaring<Boolean>): Int

Remove all the elements of this sequence that satisfy the given predicate.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> Database.sequenceOf(table: T, withReferences: Boolean = true): EntitySequence<E, T>
@JvmName(name = "sequenceOfNothing")
fun <T : BaseTable<Nothing>> Database.sequenceOf(table: T, withReferences: Boolean = true): EntitySequence<Nothing, T>

Create an EntitySequence from the specific table.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.single(): E

Return the single element, or throws an exception if the sequence is empty or has more than one element.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.single(predicate: (T) -> ColumnDeclaring<Boolean>): E

Return the single element matching the given predicate, or throws exception if there is no or more than one matching element.

Link copied to clipboard

Return single element, or null if the sequence is empty or has more than one element.

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.singleOrNull(predicate: (T) -> ColumnDeclaring<Boolean>): E?

Return the single element matching the given predicate, or null if element was not found or more than one element was found.

Link copied to clipboard
fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.sortedBy(vararg selectors: (T) -> OrderByExpression): EntitySequence<E, T>

Return a sequence sorting elements by multiple columns, in ascending or descending order. For example, sortedBy({ it.col1.asc() }, { it.col2.desc() }).

inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.sortedBy(selector: (T) -> OrderByExpression): EntitySequence<E, T>

Return a sequence sorting elements by a column, in ascending or descending order. For example, sortedBy { it.col.asc() }

@JvmName(name = "sortedByAscending")
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.sortedBy(selector: (T) -> ColumnDeclaring<*>): EntitySequence<E, T>

Return a sequence sorting elements by the specific column in ascending order.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.sortedByDescending(selector: (T) -> ColumnDeclaring<*>): EntitySequence<E, T>

Return a sequence sorting elements by the specific column in descending order.

Link copied to clipboard
inline fun <E : Any, T : BaseTable<E>, C : Number> EntitySequence<E, T>.sumBy(selector: (T) -> ColumnDeclaring<C>): C?

Return the sum of the column given by selector in this sequence.

Link copied to clipboard

Returns a sequence containing first n elements.

Link copied to clipboard
fun <E : Any, C : MutableCollection<in E>> EntitySequence<E, *>.toCollection(destination: C): C

Append all elements to the given destination collection.

Link copied to clipboard

Return a HashSet containing all the elements of this sequence.

Link copied to clipboard
fun <E : Any> EntitySequence<E, *>.toList(): List<E>

Return a List containing all the elements of this sequence.

fun <E> Tuple4<E, E, E, E>.toList(): List<E>
fun <E> Tuple5<E, E, E, E, E>.toList(): List<E>
fun <E> Tuple6<E, E, E, E, E, E>.toList(): List<E>
fun <E> Tuple7<E, E, E, E, E, E, E>.toList(): List<E>
fun <E> Tuple8<E, E, E, E, E, E, E, E>.toList(): List<E>
fun <E> Tuple9<E, E, E, E, E, E, E, E, E>.toList(): List<E>

Convert this tuple into a list.

Link copied to clipboard

Return a MutableList containing all the elements of this sequence.

Link copied to clipboard

Return a MutableSet containing all the elements of this sequence.

Link copied to clipboard
fun <E : Any> EntitySequence<E, *>.toSet(): Set<E>

Return a Set containing all the elements of this sequence.

Link copied to clipboard
fun <E : Any, Comparable<E>> EntitySequence<E, *>.toSortedSet(comparator: Comparator<in E>): SortedSet<E>

Return a SortedSet containing all the elements of this sequence.

Link copied to clipboard
fun <E1, E2> tupleOf(element1: E1, element2: E2): Tuple2<E1, E2>

Create a tuple of 2 values.

fun <E1, E2, E3> tupleOf(element1: E1, element2: E2, element3: E3): Tuple3<E1, E2, E3>

Create a tuple of 3 values.

fun <E1, E2, E3, E4> tupleOf(element1: E1, element2: E2, element3: E3, element4: E4): Tuple4<E1, E2, E3, E4>

Create a tuple of 4 values.

fun <E1, E2, E3, E4, E5> tupleOf(element1: E1, element2: E2, element3: E3, element4: E4, element5: E5): Tuple5<E1, E2, E3, E4, E5>

Create a tuple of 5 values.

fun <E1, E2, E3, E4, E5, E6> tupleOf(element1: E1, element2: E2, element3: E3, element4: E4, element5: E5, element6: E6): Tuple6<E1, E2, E3, E4, E5, E6>

Create a tuple of 6 values.

fun <E1, E2, E3, E4, E5, E6, E7> tupleOf(element1: E1, element2: E2, element3: E3, element4: E4, element5: E5, element6: E6, element7: E7): Tuple7<E1, E2, E3, E4, E5, E6, E7>

Create a tuple of 7 values.

fun <E1, E2, E3, E4, E5, E6, E7, E8> tupleOf(element1: E1, element2: E2, element3: E3, element4: E4, element5: E5, element6: E6, element7: E7, element8: E8): Tuple8<E1, E2, E3, E4, E5, E6, E7, E8>

Create a tuple of 8 values.

fun <E1, E2, E3, E4, E5, E6, E7, E8, E9> tupleOf(element1: E1, element2: E2, element3: E3, element4: E4, element5: E5, element6: E6, element7: E7, element8: E8, element9: E9): Tuple9<E1, E2, E3, E4, E5, E6, E7, E8, E9>

Create a tuple of 9 values.

Link copied to clipboard
fun <E : Entity<E>, T : Table<E>> EntitySequence<E, T>.update(entity: E): Int

Update properties of the given entity to the database and return the affected record number.

Link copied to clipboard

Return a lazy Sequence that wraps each element of the original sequence into an IndexedValue containing the index of that element and the element itself.