withMapper

Wraps this ReadCRUDRepo with a mapper to expose different key and value types.

Return

A mapped repository with the new type system

Parameters

mapper

The mapper defining the type conversions

Type Parameters

FromKey

The desired external ID type

FromValue

The desired external object type

ToKey

The current internal ID type

ToValue

The current internal object type


inline fun <FromKey, FromValue, ToKey, ToValue> ReadCRUDRepo<ToValue, ToKey>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): ReadCRUDRepo<FromValue, FromKey>(source)

Wraps this ReadCRUDRepo with custom conversion functions for keys and values.

Return

A mapped repository with the new type system

Parameters

keyFromToTo

Converts external keys to internal keys

valueFromToTo

Converts external values to internal values

keyToToFrom

Converts internal keys to external keys

valueToToFrom

Converts internal values to external values

Type Parameters

FromKey

The desired external ID type

FromValue

The desired external object type

ToKey

The current internal ID type

ToValue

The current internal object type


inline fun <FromKey, FromValue, FromInput, ToKey, ToValue, ToInput> WriteCRUDRepo<ToValue, ToKey, ToInput>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline inputFromToTo: suspend FromInput.() -> ToInput = { this as ToInput }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }, noinline inputToToFrom: suspend ToInput.() -> FromInput = { this as FromInput }): WriteCRUDRepo<FromValue, FromKey, FromInput>(source)
inline fun <FromKey, FromValue, FromInput, ToKey, ToValue, ToInput> CRUDRepo<ToValue, ToKey, ToInput>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline inputFromToTo: suspend FromInput.() -> ToInput = { this as ToInput }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }, noinline inputToToFrom: suspend ToInput.() -> FromInput = { this as FromInput }): CRUDRepo<FromValue, FromKey, FromInput>(source)


Wraps this ReadKeyValueRepo with a MapperRepo to expose a mapped ReadKeyValueRepo.

Return

MapperReadKeyValueRepo wrapping this repo

Parameters

mapper

The MapperRepo providing bidirectional type conversions

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


inline fun <FromKey, FromValue, ToKey, ToValue> ReadKeyValueRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): ReadKeyValueRepo<FromKey, FromValue>(source)

Wraps this ReadKeyValueRepo with inline conversion lambdas to expose a mapped ReadKeyValueRepo.

Return

MapperReadKeyValueRepo wrapping this repo

Parameters

keyFromToTo

Converts outer key to inner key; defaults to unchecked cast

valueFromToTo

Converts outer value to inner value; defaults to unchecked cast

keyToToFrom

Converts inner key to outer key; defaults to unchecked cast

valueToToFrom

Converts inner value to outer value; defaults to unchecked cast

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


Wraps this WriteKeyValueRepo with a MapperRepo to expose a mapped WriteKeyValueRepo.

Return

MapperWriteKeyValueRepo wrapping this repo

Parameters

mapper

The MapperRepo providing bidirectional type conversions

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


inline fun <FromKey, FromValue, ToKey, ToValue> WriteKeyValueRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): WriteKeyValueRepo<FromKey, FromValue>(source)

Wraps this WriteKeyValueRepo with inline conversion lambdas to expose a mapped WriteKeyValueRepo.

Return

MapperWriteKeyValueRepo wrapping this repo

Parameters

keyFromToTo

Converts outer key to inner key; defaults to unchecked cast

valueFromToTo

Converts outer value to inner value; defaults to unchecked cast

keyToToFrom

Converts inner key to outer key; defaults to unchecked cast

valueToToFrom

Converts inner value to outer value; defaults to unchecked cast

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


Wraps this KeyValueRepo with a MapperRepo to expose a mapped KeyValueRepo.

Return

MapperKeyValueRepo wrapping this repo

Parameters

mapper

The MapperRepo providing bidirectional type conversions

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


inline fun <FromKey, FromValue, ToKey, ToValue> KeyValueRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): KeyValueRepo<FromKey, FromValue>(source)

Wraps this KeyValueRepo with inline conversion lambdas to expose a mapped KeyValueRepo.

Return

MapperKeyValueRepo wrapping this repo

Parameters

keyFromToTo

Converts outer key to inner key; defaults to unchecked cast

valueFromToTo

Converts outer value to inner value; defaults to unchecked cast

keyToToFrom

Converts inner key to outer key; defaults to unchecked cast

valueToToFrom

Converts inner value to outer value; defaults to unchecked cast

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


Wraps this ReadKeyValuesRepo with a MapperRepo to expose a mapped ReadKeyValuesRepo.

Return

MapperReadKeyValuesRepo wrapping this repo

Parameters

mapper

The MapperRepo providing bidirectional type conversions

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


inline fun <FromKey, FromValue, ToKey, ToValue> ReadKeyValuesRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): ReadKeyValuesRepo<FromKey, FromValue>(source)

Wraps this ReadKeyValuesRepo with inline conversion lambdas to expose a mapped ReadKeyValuesRepo.

Return

MapperReadKeyValuesRepo wrapping this repo

Parameters

keyFromToTo

Converts outer key to inner key; defaults to unchecked cast

valueFromToTo

Converts outer value to inner value; defaults to unchecked cast

keyToToFrom

Converts inner key to outer key; defaults to unchecked cast

valueToToFrom

Converts inner value to outer value; defaults to unchecked cast

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


Wraps this WriteKeyValuesRepo with a MapperRepo to expose a mapped WriteKeyValuesRepo.

Return

MapperWriteKeyValuesRepo wrapping this repo

Parameters

mapper

The MapperRepo providing bidirectional type conversions

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


inline fun <FromKey, FromValue, ToKey, ToValue> WriteKeyValuesRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): WriteKeyValuesRepo<FromKey, FromValue>(source)

Wraps this WriteKeyValuesRepo with inline conversion lambdas to expose a mapped WriteKeyValuesRepo.

Return

MapperWriteKeyValuesRepo wrapping this repo

Parameters

keyFromToTo

Converts outer key to inner key; defaults to unchecked cast

valueFromToTo

Converts outer value to inner value; defaults to unchecked cast

keyToToFrom

Converts inner key to outer key; defaults to unchecked cast

valueToToFrom

Converts inner value to outer value; defaults to unchecked cast

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


Wraps this KeyValuesRepo with a MapperRepo to expose a mapped KeyValuesRepo.

Return

MapperKeyValuesRepo wrapping this repo

Parameters

mapper

The MapperRepo providing bidirectional type conversions

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type


inline fun <FromKey, FromValue, ToKey, ToValue> KeyValuesRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): KeyValuesRepo<FromKey, FromValue>(source)

Wraps this KeyValuesRepo with inline conversion lambdas to expose a mapped KeyValuesRepo.

Return

MapperKeyValuesRepo wrapping this repo

Parameters

keyFromToTo

Converts outer key to inner key; defaults to unchecked cast

valueFromToTo

Converts outer value to inner value; defaults to unchecked cast

keyToToFrom

Converts inner key to outer key; defaults to unchecked cast

valueToToFrom

Converts inner value to outer value; defaults to unchecked cast

Type Parameters

FromKey

The outer key type

FromValue

The outer value type

ToKey

The inner key type

ToValue

The inner value type