Package-level declarations

Types

Link copied to clipboard
typealias Migration<T> = (version: Int?, JsonElement?) -> T?
Link copied to clipboard
class VersionedCodec<T : @Serializable Any>(file: Path, version: Int = 0, json: Json, serializer: KSerializer<T>, migration: Migration<T>, versionPath: Path = Path("$file.version")) : Codec<T>

Functions

Link copied to clipboard
fun <T> DefaultMigration(default: T?): Migration<T>
Link copied to clipboard
inline fun <T : @Serializable Any> listStoreOf(file: Path, default: List<T> = emptyList(), enableCache: Boolean = true, json: Json = Json { ignoreUnknownKeys = true; encodeDefaults = true }): KStore<List<T>>

Creates a store that contains a list

Link copied to clipboard
inline fun <T : @Serializable Any> storeOf(file: Path, version: Int, default: T? = null, enableCache: Boolean = true, json: Json = DefaultJson, versionPath: Path = Path("$file.version"), noinline migration: Migration<T> = DefaultMigration(default)): KStore<T>

Creates a store with a versioned encoder and decoder Note: An additional file will be written to manage metadata on the same path with .version suffix