asKeyValuesRepo

fun <K, V, VI : Iterable<V>> KeyValueRepo<K, VI>.asKeyValuesRepo(listToValuesIterable: suspend (List<V>) -> VI): KeyValuesFromKeyValueRepo<K, V, VI>(source)

Wraps this KeyValueRepo (mapping keys to iterables) as a KeyValuesFromKeyValueRepo, exposing a full one-to-many read-write interface.

Return

KeyValuesFromKeyValueRepo delegating to this repo

Parameters

listToValuesIterable

Converter from List of values to VI used when persisting changes

Type Parameters

K

The type of keys

V

The type of individual values within each iterable

VI

The iterable type storing multiple values per key


@JvmName(name = "asListKeyValuesRepo")
fun <K, V> KeyValueRepo<K, List<V>>.asKeyValuesRepo(): KeyValuesFromKeyValueRepo<K, V, List<V>>(source)

Wraps this KeyValueRepo (mapping keys to Lists) as a KeyValuesFromKeyValueRepo. Uses identity conversion for the list iterable.

Return

KeyValuesFromKeyValueRepo delegating to this repo with List as the iterable type

Type Parameters

K

The type of keys

V

The type of individual values


@JvmName(name = "asSetKeyValuesRepo")
fun <K, V> KeyValueRepo<K, Set<V>>.asKeyValuesRepo(): KeyValuesFromKeyValueRepo<K, V, Set<V>>(source)

Wraps this KeyValueRepo (mapping keys to Sets) as a KeyValuesFromKeyValueRepo. Converts lists to sets when persisting changes, ensuring value uniqueness per key.

Return

KeyValuesFromKeyValueRepo delegating to this repo with Set as the iterable type

Type Parameters

K

The type of keys

V

The type of individual values