Package-level declarations

Types

Link copied to clipboard
sealed class ColumnType
Link copied to clipboard

Full CRUD repository combining read and write capabilities.

Link copied to clipboard
Link copied to clipboard

Delegate-based implementation of CRUDRepo that composes separate read and write delegates.

Link copied to clipboard

Delegate-based implementation of KeyValueRepo that composes separate read and write delegates.

Link copied to clipboard

Delegate-based implementation of KeyValuesRepo that composes separate read and write delegates.

Link copied to clipboard
class FileKeyValueRepo(folder: File, filesChangedProcessingScope: CoroutineScope? = null) : KeyValueRepo<String, File> , WriteKeyValueRepo<String, File> , ReadKeyValueRepo<String, File>
Link copied to clipboard
Link copied to clipboard
class FileWriteKeyValueRepo(folder: File, filesChangedProcessingScope: CoroutineScope? = null) : WriteKeyValueRepo<String, File>

Files watching will not correctly works on Android with version of API lower than API 26

Link copied to clipboard

Full version of standard key-value repository with all set/unset/clear/get methods

Link copied to clipboard

Full one-to-many key-values repository combining read and write capabilities. Provides default implementations for clearWithValue, removeWithValue, and set.

Link copied to clipboard

MutableMap-based MapCRUDRepo. All internal operations will be locked with locker

Link copied to clipboard

MutableMap-based KeyValueRepo. All internal operations will be locked with locker

Link copied to clipboard

MutableMap-based KeyValuesRepo. All internal operations will be locked with locker

Link copied to clipboard

Interface for repositories that provide bidirectional mapping between two sets of key-value types. This is useful for adapting repositories to work with different key and value types.

Link copied to clipboard
class MapReadKeyValuesRepo<Key, Value>(map: Map<Key, List<Value>> = emptyMap(), locker: SmartRWLocker = SmartRWLocker()) : ReadKeyValuesRepo<Key, Value>

Map-based ReadKeyValuesRepo. All internal operations will be locked with locker (mostly with SmartRWLocker.withReadAcquire)

Link copied to clipboard
class MapWriteKeyValuesRepo<Key, Value>(map: MutableMap<Key, MutableList<Value>> = mutableMapOf(), locker: SmartRWLocker = SmartRWLocker()) : WriteKeyValuesRepo<Key, Value>

MutableMap-based WriteKeyValuesRepo. All internal operations will be locked with locker (mostly with SmartRWLocker.withWriteLock)

Link copied to clipboard
Link copied to clipboard

Read-only part of a standard CRUD repository.

Link copied to clipboard

Read part of KeyValueRepo

Link copied to clipboard

Read part of KeyValuesRepo for one-to-many key-value relationships. This repository type allows multiple values to be associated with a single key.

Link copied to clipboard
class ReadMapCRUDRepo<ObjectType, IdType>(map: Map<IdType, ObjectType> = emptyMap(), locker: SmartRWLocker = SmartRWLocker()) : ReadCRUDRepo<ObjectType, IdType>

Map-based ReadMapCRUDRepo. All internal operations will be locked with locker (mostly with SmartRWLocker.withReadAcquire)

Link copied to clipboard

Map-based ReadKeyValueRepo. All internal operations will be locked with locker (mostly with SmartRWLocker.withReadAcquire)

Link copied to clipboard

Type alias for ReadKeyValuesRepo emphasizing one-to-many relationships.

Link copied to clipboard
interface Repo

Base marker interface for all repository types in the MicroUtils library. This interface serves as a common ancestor for specialized repository interfaces like ReadCRUDRepo, WriteCRUDRepo, ReadKeyValueRepo, WriteKeyValueRepo, etc.

Link copied to clipboard
class SimpleMapperRepo<FromKey, FromValue, ToKey, ToValue>(keyFromToTo: suspend FromKey.() -> ToKey, valueFromToTo: suspend FromValue.() -> ToValue, keyToToFrom: suspend ToKey.() -> FromKey, valueToToFrom: suspend ToValue.() -> FromValue) : MapperRepo<FromKey, FromValue, ToKey, ToValue>

Simple implementation of MapperRepo that uses provided conversion functions.

Link copied to clipboard
Link copied to clipboard
class StandardSQLHelper(context: Context, name: String, factory: SQLiteDatabase.CursorFactory? = null, version: Int = 1, errorHandler: DatabaseErrorHandler? = null, useSharedPreferencesForVersions: Boolean = false)
Link copied to clipboard
Link copied to clipboard

Type alias representing a pair of ID and updated value, used in batch update operations.

Link copied to clipboard

Write part of a standard CRUD repository. Provides create, update, and delete operations with reactive flows for change notifications.

Link copied to clipboard

Write part of KeyValueRepo

Link copied to clipboard

Write part of KeyValuesRepo for one-to-many key-value relationships. Provides methods for adding, removing, and clearing values associated with keys.

Link copied to clipboard
abstract class WriteMapCRUDRepo<ObjectType, IdType, InputValueType>(map: MutableMap<IdType, ObjectType> = mutableMapOf(), locker: SmartRWLocker = SmartRWLocker()) : WriteCRUDRepo<ObjectType, IdType, InputValueType>

MutableMap-based WriteMapCRUDRepo. All internal operations will be locked with locker (mostly with SmartRWLocker.withWriteLock)

Link copied to clipboard

MutableMap-based WriteKeyValueRepo. All internal operations will be locked with locker (mostly with SmartRWLocker.withWriteLock)

Link copied to clipboard

Type alias for WriteKeyValuesRepo emphasizing one-to-many relationships.

Properties

Link copied to clipboard

Returns the ID component of an UpdatedValuePair.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Returns the value component of an UpdatedValuePair.

Functions

Link copied to clipboard
inline suspend fun <Key, Value, REPO : WriteKeyValuesRepo<Key, Value>> REPO.add(keysAndValues: List<Pair<Key, List<Value>>>)

List-of-pairs overload of WriteKeyValuesRepo.add.

inline suspend fun <Key, Value, REPO : WriteKeyValuesRepo<Key, Value>> REPO.add(vararg keysAndValues: Pair<Key, List<Value>>)

Vararg overload of WriteKeyValuesRepo.add.

inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.add(k: Key, v: List<Value>)

Single-key overload of WriteKeyValuesRepo.add accepting a list of values.

inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.add(k: Key, vararg v: Value)

Single-key vararg overload of WriteKeyValuesRepo.add.

Link copied to clipboard
fun <ObjectType, IdType, InputValueType> MutableMap<IdType, ObjectType>.asCrudRepo(updateCallback: suspend MutableMap<IdType, ObjectType>.(newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType, locker: SmartRWLocker = SmartRWLocker(), createCallback: suspend MutableMap<IdType, ObjectType>.(newValue: InputValueType) -> Pair<IdType, ObjectType>): MapCRUDRepo<ObjectType, IdType, newValue: InputValueType>

MutableMap-based MapCRUDRepo. All internal operations will be locked with locker

Link copied to clipboard
fun <K, V> MutableMap<K, V>.asKeyValueRepo(locker: SmartRWLocker = SmartRWLocker()): KeyValueRepo<K, V>

MutableMap-based KeyValueRepo. All internal operations will be locked with locker

Link copied to clipboard
fun <K, V> MutableMap<K, List<V>>.asKeyValuesRepo(locker: SmartRWLocker = SmartRWLocker()): KeyValuesRepo<K, V>

MutableMap-based KeyValuesRepo. All internal operations will be locked with locker

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun SQLiteDatabase.createTable(tableName: String, vararg columnsToTypes: Pair<String, ColumnType>, onInit: SQLiteDatabase.() -> Unit? = null): Boolean
Link copied to clipboard
fun createTableQuery(tableName: String, vararg columnsToTypes: Pair<String, ColumnType>): String
Link copied to clipboard

Vararg overload of WriteCRUDRepo.deleteById for convenience.

Link copied to clipboard
Link copied to clipboard
fun Cursor.getDouble(columnName: String): Double
Link copied to clipboard
fun Cursor.getDoubleOrNull(columnName: String): Double?
Link copied to clipboard
fun Cursor.getFloat(columnName: String): Float
Link copied to clipboard
fun Cursor.getFloatOrNull(columnName: String): Float?
Link copied to clipboard
fun Cursor.getInt(columnName: String): Int
Link copied to clipboard
fun Cursor.getIntOrNull(columnName: String): Int?
Link copied to clipboard
fun Cursor.getLong(columnName: String): Long
Link copied to clipboard
fun Cursor.getLongOrNull(columnName: String): Long?
Link copied to clipboard
fun Cursor.getShort(columnName: String): Short
Link copied to clipboard
fun Cursor.getShortOrNull(columnName: String): Short?
Link copied to clipboard
fun Cursor.getString(columnName: String): String
Link copied to clipboard
fun Cursor.getStringOrNull(columnName: String): String?
Link copied to clipboard
inline fun <T> SQLiteDatabase.inlineTransaction(crossinline block: SQLiteDatabase.() -> T): T
Link copied to clipboard
operator fun <FromKey, FromValue, ToKey, ToValue> MapperRepo.Companion.invoke(keyFromToTo: suspend FromKey.() -> ToKey, valueFromToTo: suspend FromValue.() -> ToValue, keyToToFrom: suspend ToKey.() -> FromKey, valueToToFrom: suspend ToValue.() -> FromValue): SimpleMapperRepo<FromKey, FromValue, ToKey, ToValue>

Factory function for creating a SimpleMapperRepo with custom conversion functions.

Link copied to clipboard
Link copied to clipboard
fun limitClause(size: Int, since: Int? = null): String
fun limitClause(size: Long, since: Long? = null): String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T> Cursor.map(block: (Cursor) -> T): List<T>
Link copied to clipboard
fun <ObjectType, IdType, InputValueType> MapCRUDRepo(updateCallback: suspend MutableMap<IdType, ObjectType>.(newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType, locker: SmartRWLocker = SmartRWLocker(), createCallback: suspend MutableMap<IdType, ObjectType>.(newValue: InputValueType) -> Pair<IdType, ObjectType>): MapCRUDRepo<ObjectType, IdType, newValue: InputValueType>
fun <ObjectType, IdType, InputValueType> MapCRUDRepo(map: MutableMap<IdType, ObjectType>, updateCallback: suspend MutableMap<IdType, ObjectType>.(newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType, locker: SmartRWLocker = SmartRWLocker(), createCallback: suspend MutableMap<IdType, ObjectType>.(newValue: InputValueType) -> Pair<IdType, ObjectType>): MapCRUDRepo<ObjectType, IdType, InputValueType>

MutableMap-based MapCRUDRepo. All internal operations will be locked with locker

Link copied to clipboard
inline fun <FromKey, FromValue, ToKey, ToValue> mapper(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 }): SimpleMapperRepo<FromKey, FromValue, ToKey, ToValue>

Creates a MapperRepo with optional custom conversion functions. By default, uses casting for type conversions.

Link copied to clipboard
fun <T> MapsReposDefaultMutableSharedFlow(): MutableSharedFlow<T>
Link copied to clipboard
suspend fun <T> SQLiteOpenHelper.readableTransaction(block: suspend SQLiteDatabase.() -> T): T
Link copied to clipboard
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(keysAndValues: List<Pair<Key, List<Value>>>)

List-of-pairs overload of WriteKeyValuesRepo.remove.

inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(vararg keysAndValues: Pair<Key, List<Value>>)

Vararg overload of WriteKeyValuesRepo.remove.

inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(k: Key, v: List<Value>)

Single-key overload of WriteKeyValuesRepo.remove accepting a list of values.

inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(k: Key, vararg v: Value)

Single-key vararg overload of WriteKeyValuesRepo.remove.

Link copied to clipboard
fun SQLiteDatabase.select(table: String, columns: Array<String>? = null, selection: String? = null, selectionArgs: Array<String>? = null, groupBy: String? = null, having: String? = null, orderBy: String? = null, limit: String? = null): Cursor
Link copied to clipboard
fun SQLiteDatabase.selectDistinct(table: String, columns: Array<String>? = null, selection: String? = null, selectionArgs: Array<String>? = null, groupBy: String? = null, having: String? = null, orderBy: String? = null, limit: String? = null): Cursor
Link copied to clipboard
inline suspend fun <Key, Value, REPO : WriteKeyValuesRepo<Key, Value>> REPO.set(keysAndValues: List<Pair<Key, List<Value>>>)

List-of-pairs overload of WriteKeyValuesRepo.set.

inline suspend fun <Key, Value, REPO : WriteKeyValuesRepo<Key, Value>> REPO.set(vararg keysAndValues: Pair<Key, List<Value>>)

Vararg overload of WriteKeyValuesRepo.set.

inline suspend fun <Key, Value> WriteKeyValueRepo<Key, Value>.set(toSet: List<Pair<Key, Value>>)

List overload of WriteKeyValueRepo.set accepting a list of pairs.

inline suspend fun <Key, Value> WriteKeyValueRepo<Key, Value>.set(vararg toSet: Pair<Key, Value>)

Vararg overload of WriteKeyValueRepo.set accepting pairs.

inline suspend fun <Key, Value> WriteKeyValueRepo<Key, Value>.set(k: Key, v: Value)

Single-entry overload of WriteKeyValueRepo.set.

inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.set(k: Key, v: List<Value>)

Single-key overload of WriteKeyValuesRepo.set accepting a list of values.

inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.set(k: Key, vararg v: Value)

Single-key vararg overload of WriteKeyValuesRepo.set.

Link copied to clipboard
suspend fun <T> SQLiteDatabase.transaction(block: suspend SQLiteDatabase.() -> T): T
Link copied to clipboard
inline suspend fun <Key, Value> WriteKeyValueRepo<Key, Value>.unset(vararg k: Key)

Vararg overload of WriteKeyValueRepo.unset.

Link copied to clipboard
inline suspend fun <Key, Value> WriteKeyValueRepo<Key, Value>.unsetWithValues(vararg v: Value)
Link copied to clipboard
Link copied to clipboard
suspend fun <T> SQLiteOpenHelper.writableTransaction(block: suspend SQLiteDatabase.() -> T): T