# AbstractExposedWriteCRUDRepo

abstract class AbstractExposedWriteCRUDRepo < ObjectType , IdType , InputValueType >(flowsChannelsSize: Int = 0, tableName: String = "", replyCacheInFlows: Int = 0, onBufferOverflowBehaviour: BufferOverflow = BufferOverflow.SUSPEND) : AbstractExposedReadCRUDRepo < ObjectType , IdType > , ExposedCRUDRepo < ObjectType , IdType > , WriteCRUDRepo < ObjectType , IdType , InputValueType > (source)

#### Inheritors

AbstractExposedCRUDRepo

## Constructors

AbstractExposedWriteCRUDRepo
Link copied to clipboard
constructor(flowsChannelsSize: Int = 0, tableName: String = "", replyCacheInFlows: Int = 0, onBufferOverflowBehaviour: BufferOverflow = BufferOverflow.SUSPEND)

## Properties

asId
Link copied to clipboard
abstract val ERROR CLASS: Symbol not found for ResultRow. asId : IdType
asObject
Link copied to clipboard
abstract val ERROR CLASS: Symbol not found for ResultRow. asObject : ObjectType
database
Link copied to clipboard
abstract val database : ERROR CLASS: Symbol not found for Database
deletedObjectsIdsFlow
Link copied to clipboard
open override val deletedObjectsIdsFlow : Flow< IdType >

Flow that emits the ID of each deleted object after a successful deleteById call.

newObjectsFlow
Link copied to clipboard
open override val newObjectsFlow : Flow< ObjectType >

Flow that emits each newly created object after a successful create call.

onDeletedObjectsIds
Link copied to clipboard
val < IdType > WriteCRUDRepo <*, IdType , *>. onDeletedObjectsIds : Flow< IdType >

Mirrors WriteCRUDRepo.deletedObjectsIdsFlow under the name onDeletedObjectsIds for consistency with KV repos naming.

onNewObjects
Link copied to clipboard
val < ObjectType > WriteCRUDRepo < ObjectType , *, *>. onNewObjects : Flow< ObjectType >

Mirrors WriteCRUDRepo.newObjectsFlow under the name onNewObjects for consistency with KV repos naming.

onUpdatedObjects
Link copied to clipboard
val < ObjectType > WriteCRUDRepo < ObjectType , *, *>. onUpdatedObjects : Flow< ObjectType >

Mirrors WriteCRUDRepo.updatedObjectsFlow under the name onUpdatedObjects for consistency with KV repos naming.

selectAll
Link copied to clipboard
open val selectAll : ERROR CLASS: Symbol not found for Transaction.() -> ERROR CLASS: Symbol not found for Query
selectById
Link copied to clipboard
abstract val selectById : ( IdType ) -> ERROR CLASS: Symbol not found for Op<kotlin/Boolean>
selectByIds
Link copied to clipboard
open val selectByIds : ( List < IdType >) -> ERROR CLASS: Symbol not found for Op<kotlin/Boolean>
updatedObjectsFlow
Link copied to clipboard
open override val updatedObjectsFlow : Flow< ObjectType >

Flow that emits each updated object after a successful update call.

## Functions

asReadKeyValueRepo
Link copied to clipboard
fun < K , V > ReadCRUDRepo < K , V >. asReadKeyValueRepo (): ReadKeyValueFromCRUDRepo < V , K >

Wraps this ReadCRUDRepo as a ReadKeyValueFromCRUDRepo, exposing CRUD IDs as keys and CRUD objects as values in a ReadKeyValueRepo.

cached
Link copied to clipboard
fun < ObjectType , IdType > ReadCRUDRepo < ObjectType , IdType >. cached (kvCache: KVCache < IdType , ObjectType >, locker: SmartRWLocker = SmartRWLocker(), idGetter: ( ObjectType ) -> IdType ): ReadCRUDCacheRepo < ObjectType , IdType >
fun < ObjectType , IdType > ReadCRUDRepo < ObjectType , IdType >. cached (kvCache: KeyValueRepo < IdType , ObjectType >, locker: SmartRWLocker = SmartRWLocker(), idGetter: ( ObjectType ) -> IdType ): FullReadCRUDCacheRepo < ObjectType , IdType >
caching
Link copied to clipboard
fun < ObjectType , IdType , InputType > WriteCRUDRepo < ObjectType , IdType , InputType >. caching (kvCache: KVCache < IdType , ObjectType >, scope: CoroutineScope, locker: SmartRWLocker = SmartRWLocker(), idGetter: ( ObjectType ) -> IdType ): WriteCRUDCacheRepo < ObjectType , IdType , InputType >
contains
Link copied to clipboard
open suspend override fun contains (id: IdType ): Boolean

Returns true if an object with the given id exists in the repository.

count
Link copied to clipboard
open suspend override fun count (): Long

Returns the total count of objects stored in the repository.

create
Link copied to clipboard
open suspend override fun create (values: List < InputValueType >): List < ObjectType >

Creates new objects from the given list of input values. Successfully created objects must be emitted via newObjectsFlow.

create
Link copied to clipboard
suspend fun < ObjectType , IdType , InputValueType > WriteCRUDRepo < ObjectType , IdType , InputValueType >. create (vararg values: InputValueType ): List < ObjectType >

Vararg overload of WriteCRUDRepo.create for convenience.

deleteById
Link copied to clipboard
open suspend override fun deleteById (ids: List < IdType >)

Deletes objects with the given list of IDs. Successfully deleted IDs must be emitted via deletedObjectsIdsFlow.

deleteById
Link copied to clipboard
suspend fun < ObjectType , IdType , InputValueType > WriteCRUDRepo < ObjectType , IdType , InputValueType >. deleteById (vararg ids: IdType )

Vararg overload of WriteCRUDRepo.deleteById for convenience.

diff
Link copied to clipboard
suspend fun < Id , Registered > ReadCRUDRepo < Registered , Id >. diff (other: Map < Id , Registered >): MapDiff < Id , Registered >

Computes the difference between this ReadCRUDRepo and a map of items. Retrieves all items from the repository and compares them with the provided map.

directlyCached
Link copied to clipboard
fun < ObjectType , IdType > ReadCRUDRepo < ObjectType , IdType >. directlyCached (kvCache: KeyValueRepo < IdType , ObjectType >, locker: SmartRWLocker = SmartRWLocker(), idGetter: ( ObjectType ) -> IdType ): DirectFullReadCRUDCacheRepo < ObjectType , IdType >
getAll
Link copied to clipboard
open suspend override fun getAll (): Map < IdType , ObjectType >

Returns all objects in the repository as a map of ID to object. Default implementation iterates all pages using getIdsByPagination and getById.

getById
Link copied to clipboard
open suspend override fun getById (id: IdType ): ObjectType ?

Returns the object associated with the given id, or null if not found.

getByPagination
Link copied to clipboard
open suspend override fun getByPagination (pagination: Pagination ): PaginationResult < ObjectType >

Returns a paginated list of all objects in the repository.

getIdsByPagination
Link copied to clipboard
open suspend override fun getIdsByPagination (pagination: Pagination ): PaginationResult < IdType >

Returns a paginated list of all IDs in the repository.

maxPagePagination
Link copied to clipboard
inline suspend fun ReadCRUDRepo <*, *>. maxPagePagination (): SimplePagination

Creates a pagination starting from the first page with size equal to the total count of items in this ReadCRUDRepo. This effectively creates a single page containing all items.

update
Link copied to clipboard
open suspend override fun update (values: List < UpdatedValuePair < IdType , InputValueType >>): List < ObjectType >

Batch-updates objects using the given list of ID-value pairs. Successfully updated objects must be emitted via updatedObjectsFlow.

open suspend override fun update (id: IdType , value: InputValueType ): ObjectType ?

Updates the object identified by id with the given value. Successfully updated object must be emitted via updatedObjectsFlow.

update
Link copied to clipboard
suspend fun < ObjectType , IdType , InputValueType > WriteCRUDRepo < ObjectType , IdType , InputValueType >. update (vararg values: UpdatedValuePair < IdType , InputValueType >): List < ObjectType >

Vararg overload of WriteCRUDRepo.update for convenience.

withMapper
Link copied to clipboard
inline fun < FromKey , FromValue , ToKey , ToValue > ReadCRUDRepo < ToValue , ToKey >. withMapper (mapper: MapperRepo < FromKey , FromValue , ToKey , ToValue >): ReadCRUDRepo < FromValue , FromKey >

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

inline fun < FromKey , FromValue , FromInput , ToKey , ToValue , ToInput > WriteCRUDRepo < ToValue , ToKey , ToInput >. withMapper (mapper: MapperRepo < FromKey , FromValue , ToKey , ToValue >, simpleSuspendableMapper: SimpleSuspendableMapper < FromInput , ToInput >): WriteCRUDRepo < FromValue , FromKey , FromInput >
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 >
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 >

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