first

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

Especially, if a dialect is enabled, this function will use the pagination feature to obtain the very record only. Assuming we are using MySQL, a SQL containing limit 0, 1 will be generated. But if there are no dialects enabled, then all records in the sequence will be obtained to ensure the function just works.

The operation is terminal.


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

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

Especially, if a dialect is enabled, this function will use the pagination feature to obtain the very record only. Assuming we are using MySQL, a SQL containing limit 0, 1 will be generated. But if there are no dialects enabled, then all records in the sequence matching the given predicate will be obtained to ensure the function just works.

The operation is terminal.