English | 简体中文

api-docs / org.ktorm.entity / eachCountTo

eachCountTo

fun <E : Any, T : BaseTable<E>, K : Any, M : MutableMap<in K?, Int>> EntityGrouping<E, T, K>.eachCountTo(
    destination: M
): M
(source code)

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

The key for each group is provided by the EntityGrouping.keySelector function, and the generated SQL is like:
select key, count(*) from source group by key.

Parameters

destination - a MutableMap used to store the results.

Return
the destination map associating the key of each group with the count of elements in the group.