import DatabaseTransaction from 'electron-coresqlite/lib/database-transaction.js'
DatabaseTransaction
DatabaseTransaction exposes a convenient API for querying and modifying an RxDB within a SQLite transaction.
You shouldn't need to instantiate this class directly. Instead, use RxDatabase#inTransaction.
Constructor Summary
Public Constructor | ||
public |
constructor(database: *) |
Member Summary
Public Members | ||
public |
database: * |
Method Summary
Public Methods | ||
public |
count(args: ...*): * |
|
public |
execute(fn: *): * |
|
public |
find(args: ...*): * |
|
public |
findAll(args: ...*): * |
|
public |
findBy(args: ...*): * |
|
public |
findJSONBlob(args: ...*): * |
|
public |
modelify(args: ...*): * |
|
public |
persistJSONBlob(id: *, json: *): * |
|
public |
persistModel(model: Model): Promise Asynchronously writes |
|
public |
persistModels(models: Array): Promise Asynchronously writes |
|
public |
unpersistModel(model: Model): Promise Asynchronously removes |
Public Constructors
public constructor(database: *) source
Params:
Name | Type | Attribute | Description |
database | * |
Public Members
public database: * source
Public Methods
public persistJSONBlob(id: *, json: *): * source
Params:
Name | Type | Attribute | Description |
id | * | ||
json | * |
Return:
* |
public persistModel(model: Model): Promise source
Asynchronously writes model
to the cache and triggers a change event.
Params:
Name | Type | Attribute | Description |
model | Model | A {Model} to write to the database. |
Return:
Promise | A promise that:
|
public persistModels(models: Array): Promise source
Asynchronously writes models
to the cache and triggers a single change
event. Note: Models must be of the same class to be persisted in a batch operation.
Params:
Name | Type | Attribute | Description |
models | Array | An {Array} of {Model} objects to write to the database. |
Return:
Promise | A promise that:
|
public unpersistModel(model: Model): Promise source
Asynchronously removes model
from the cache and triggers a change event.
Params:
Name | Type | Attribute | Description |
model | Model | A {Model} to write to the database. |
Return:
Promise | A promise that
|