LocalStorageEntity

class LocalStorageEntity<T, I>(resource: Resource<T, I>, prefix: String) : EntityRepository<T, I>

provides crud-functions for localStorage to deal with a single entity

Parameters

prefix

prefix used for prepending to the keys

resource

definition of the Resource to use

Constructors

LocalStorageEntity
Link copied to clipboard
js
fun <T, I> LocalStorageEntity(resource: Resource<T, I>, prefix: String)
definition of the Resource to use

Functions

addOrUpdate
Link copied to clipboard
js
open suspend override fun addOrUpdate(entity: T): T
adds or updates the serialized entity to localStorage using prefix and id defined in resource
delete
Link copied to clipboard
js
open suspend override fun delete(entity: T)
deletes the entity in localStorage
equals
Link copied to clipboard
js
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
js
open fun hashCode(): Int
load
Link copied to clipboard
js
open suspend override fun load(id: I): T
loads an entity from localStorage using prefix and id defined in resource
toString
Link copied to clipboard
js
open fun toString(): String