|
8 | 8 | * @since v4.0.0 |
9 | 9 | */ |
10 | 10 | /// persister-sqlite3 |
| 11 | +/** |
| 12 | + * The Sqlite3Persister interface is a minor extension to the Persister |
| 13 | + * interface. |
| 14 | + * |
| 15 | + * It simply provides an extra getDb method for accessing a reference to the |
| 16 | + * database instance the Store is being persisted to. |
| 17 | + * @since v4.3.14 |
| 18 | + */ |
| 19 | +/// Sqlite3Persister |
| 20 | +{ |
| 21 | + /** |
| 22 | + * The getDb method returns a reference to the database instance the Store is |
| 23 | + * being persisted to. |
| 24 | + * @returns A reference to the database instance. |
| 25 | + * @example |
| 26 | + * This example creates a Persister object against a newly-created Store and |
| 27 | + * then gets the database instance back out again. |
| 28 | + * |
| 29 | + * ```js |
| 30 | + * const db = new sqlite3.Database(':memory:'); |
| 31 | + * const store = createStore().setTables({pets: {fido: {species: 'dog'}}}); |
| 32 | + * const persister = createSqlite3Persister(store, db, 'my_tinybase'); |
| 33 | + * |
| 34 | + * console.log(persister.getDb() == db); |
| 35 | + * // -> true |
| 36 | + * |
| 37 | + * persister.destroy(); |
| 38 | + * ``` |
| 39 | + * @category Getter |
| 40 | + * @since v4.3.14 |
| 41 | + */ |
| 42 | + /// Sqlite3Persister.getDb |
| 43 | +} |
11 | 44 | /** |
12 | 45 | * The createSqlite3Persister function creates a Persister object that can |
13 | 46 | * persist the Store to a local SQLite database (in an appropriate environment). |
|
38 | 71 | * @param onIgnoredError An optional handler for the errors that the Persister |
39 | 72 | * would otherwise ignore when trying to save or load data. This is suitable for |
40 | 73 | * debugging persistence issues in a development environment, since v4.0.4. |
41 | | - * @returns A reference to the new Persister object. |
| 74 | + * @returns A reference to the new Sqlite3Persister object. |
42 | 75 | * @example |
43 | | - * This example creates a Persister object and persists the Store to a local |
44 | | - * SQLite database as a JSON serialization into the `my_tinybase` table. It |
45 | | - * makes a change to the database directly and then reloads it back into the |
| 76 | + * This example creates a Sqlite3Persister object and persists the Store to a |
| 77 | + * local SQLite database as a JSON serialization into the `my_tinybase` table. |
| 78 | + * It makes a change to the database directly and then reloads it back into the |
46 | 79 | * Store. |
47 | 80 | * |
48 | 81 | * ```js |
|
74 | 107 | * persister.destroy(); |
75 | 108 | * ``` |
76 | 109 | * @example |
77 | | - * This example creates a Persister object and persists the Store to a local |
78 | | - * SQLite database with tabular mapping. |
| 110 | + * This example creates a Sqlite3Persister object and persists the Store to a |
| 111 | + * local SQLite database with tabular mapping. |
79 | 112 | * |
80 | 113 | * ```js |
81 | 114 | * const db = new sqlite3.Database(':memory:'); |
|
0 commit comments