From 9b7fe92e3136963f084710ecb5b2a04ee60afc58 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 27 Nov 2024 02:43:50 +0100 Subject: [PATCH] doc: add added tag and fix typo sqlite.md --- doc/api/sqlite.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/api/sqlite.md b/doc/api/sqlite.md index 4e27d0d8bc5f26..137298564f03ff 100644 --- a/doc/api/sqlite.md +++ b/doc/api/sqlite.md @@ -156,6 +156,10 @@ around [`sqlite3_prepare_v2()`][]. ### `database.createSession([options])` + + * `options` {Object} The configuration options for the session. * `table` {string} A specific table to track changes for. By default, changes to all tables are tracked. * `db` {string} Name of the database to track. This is useful when multiple databases have been added using [`ATTACH DATABASE`][]. **Default**: `'main'`. @@ -165,6 +169,10 @@ Creates and attaches a session to the database. This method is a wrapper around ### `database.applyChangeset(changeset[, options])` + + * `changeset` {Uint8Array} A binary changeset or patchset. * `options` {Object} The configuration options for how the changes will be applied. * `filter` {Function} Skip changes that, when targeted table name is supplied to this function, return a truthy value. @@ -172,7 +180,7 @@ Creates and attaches a session to the database. This method is a wrapper around * `onConflict` {number} Determines how conflicts are handled. **Default**: `SQLITE_CHANGESET_ABORT`. * `SQLITE_CHANGESET_OMIT`: conflicting changes are omitted. * `SQLITE_CHANGESET_REPLACE`: conflicting changes replace existing values. - * `SQLITE_CHANGESET_ABORT`: abort on conflict and roll back databsase. + * `SQLITE_CHANGESET_ABORT`: abort on conflict and roll back database. * Returns: {boolean} Whether the changeset was applied succesfully without being aborted. An exception is thrown if the database is not @@ -198,8 +206,16 @@ targetDb.applyChangeset(changeset); ## Class: `Session` + + ### `session.changeset()` + + * Returns: {Uint8Array} Binary changeset that can be applied to other databases. Retrieves a changeset containing all changes since the changeset was created. Can be called multiple times. @@ -207,6 +223,10 @@ An exception is thrown if the database or the session is not open. This method i ### `session.patchset()` + + * Returns: {Uint8Array} Binary patchset that can be applied to other databases. Similar to the method above, but generates a more compact patchset. See [Changesets and Patchsets][]