English | 简体中文

api-docs / org.ktorm.entity / find

find

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

Return the first element matching the given predicate, or null if no such element was 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.