Implements Symbol.asyncDispose for await using blocks.
Throws PendingChangesError when there are unsaved changes at
the time of disposal — callers must call saveChanges() or
discardChanges() before the scope exits.
Attach an entity to the identity map so its changes will be tracked. If an entity with the same primary key is already tracked, the existing tracked object is returned (identity-map guarantee).
— the property name used when registering the entity
(e.g. 'todos' for createDb(knex, { todos: TodoEntity })).
Remove an entity from the identity map. Any subsequent changes to the
object will not be persisted by saveChanges.
Discard all pending changes. Modified entries are reset to their
snapshots; Added entries are detached; Deleted entries are restored
to Unchanged.
Get the public entry-state view for a tracked entity.
Register a callback that is invoked for each changed entry just before the changes are flushed to the database. Use to apply audit fields etc.
Reload a tracked entity from the database, overwriting its current values and refreshing the internal snapshot.
Mark a tracked entity for deletion on the next saveChanges() call.
Flush all pending changes to the database inside a single transaction.
Counts of inserted, updated, and deleted rows.
Extended context returned when
{ tracking: true }is passed to createDb. Adds identity-map tracking, unit-of-worksaveChanges, and[Symbol.asyncDispose]support forawait usingblocks.