Skip to content

Commit af7d38e

Browse files
committed
doc: improvements
1 parent a2b352b commit af7d38e

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

doc/api/sqlite.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,22 +158,23 @@ around [`sqlite3_prepare_v2()`][].
158158
* `options` {Object} An optional object used to configure the session.
159159
* `table` {string} When provided, only changes to this table are tracked by the created session.
160160
By default, changes to all tables are tracked.
161-
* `db` {string} Name of the database. Default: `'main'`.
161+
* `db` {string} Name of the database to track. Default: `'main'`.
162162
* Returns: {Session} A session handle.
163163

164-
Creates and attackes a session to the database. This method is a wrapper around [`sqlite3session_create()`][] and [`sqlite3session_attach()`][].
164+
Creates and attaches a session to the database. This method is a wrapper around [`sqlite3session_create()`][] and [`sqlite3session_attach()`][].
165165

166166
### `database.applyChangeset(changeset[, options])`
167167

168-
* `changeset` {Uint8Array} A binary changeset.
169-
* `options` {Object} An optional object.
170-
* `filter` {Function} Optional function that takes the name of a table as the first argument.
171-
When `true` is returned, includes the change, otherwise, it is discarded. When not provided
172-
no changes are filtered, and all are changes are attempted.
168+
* `changeset` {Uint8Array} A binary changeset or patchset.
169+
* `options` {Object} An optional object to configure how changes are applied.
170+
* `filter` {Function} Optional function that allows skipping changes based on the name of a table
171+
(passed as the first argument) based on a boolean returned. When not provided no changes are
172+
filtered, and all are changes are attempted.
173173
* `onConflict` {number} When provided, must be one of `SQLITE_CHANGESET_OMIT`,
174174
`SQLITE_CHANGESET_REPLACE` or `SQLITE_CHANGESET_ABORT`. Determines how conflicts are handled.
175175
Conflicting changes are either omitted, changes replace existing values or the
176-
call is aborted when the first conflicting change is encountered (this is the default).
176+
call is aborted when the first conflicting change is encountered. Aborting on
177+
conflict is the default when no value is provided for this option.
177178
* Returns: {boolean} Whether the changeset was applied succesfully without being aborted.
178179

179180
An exception is thrown if the database is not
@@ -195,7 +196,8 @@ insert.run(1, 'hello');
195196
insert.run(2, 'world');
196197

197198
const changeset = session.changeset();
198-
database2.applyChangeset(changeset); // Will now contain the same data as database1
199+
database2.applyChangeset(changeset);
200+
// Now database2 contains the same data as database1
199201
```
200202

201203
## Class: `Session`

0 commit comments

Comments
 (0)