getDb
The getDb
method returns a reference to the database instance the Store
is being persisted to.
getDb(): Database
returns | Database | A reference to the database instance. |
---|
Example
This example creates a Persister
object against a newly-created Store
and then gets the database instance back out again.
import {Database} from 'sqlite3';
import {createSqlite3Persister} from 'tinybase/persisters/persister-sqlite3';
import {createStore} from 'tinybase';
const db = new Database(':memory:');
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
const persister = createSqlite3Persister(store, db, 'my_tinybase');
console.log(persister.getDb() == db);
// -> true
persister.destroy();
Since
v4.3.14