Generic Type <T>: Type of the data stored in the db
static forDatabase()
Generic type <T>: Type of the data stored in the db
Create a MicroDBDriver instance for a (running) MicroDBBase instance.
Returns: Promise<MicroDBDriver<T>>
Returns a reference to the underlying MicroDBBase.
Type: readonly MicroDBBase
Returns a reference to the active janitor instance (if a janitorCronjob got defined in the options).
Type: readonly MicroDBJanitor | undefined
isInitialized()
Returns the initialization state of the underlying MicroDBBase.
Type: readonly boolean
Initialize the underlining MicroDBBase instance.
Returns: Promise<void>
Closes the underlining MicroDBBase instance.
Returns: Promise<void>
Create a new database record.
Returns: Promise<string> (internal id of the new record)
Select a record by internal id (returned by create method).
Returns: Promise<MicroDBEntry<T> | undefined>
Select the first record satisfying the predicate.
Remember: Where-Predicates must be synchronous
Returns: Promise<MicroDBEntry<T> | undefined>
selectAllWhere()
Select all records satisfying the predicate.
Returns: Promise<MicroDBEntry<T>[]>
Select all records.
Returns: MicroDBEntry<T>[]
Update a record by internal id (returned by create method).
Returns: Promise<boolean> (if record could be updated)
Update the first record satisfying the predicate.
Returns: Promise<boolean> (if record could be updated)
updateAllWhere()
Update all records satisfying the predicate.
Returns: Promise<number> (count of updated records)
Mutate a record by internal id (returned by create] method).
Returns: Promise<boolean> (if record could be mutated)
Mutates the first record satisfying the predicate.
Returns: Promise<boolean> (if record could be mutated)
mutateAllWhere()
Mutate all records satisfying the predicate.
Returns: Promise<number> (count of mutated records)
Mutate all records.
Returns: Promise<number> (count of mutated records)
Delete a record by internal id (returned by create] method).
Returns: Promise<boolean> (if a record could be deleted)
Delete the first record satisfying the predicate.
Returns: Promise<oolean> (if a record could be deleted)
deleteAllWhere()
Delete all records satisfying the predicate.
Returns: Promise<number> (count of deleted records)
Delete all data from the database.