Skip to content

Commit faf5629

Browse files
committed
[docs] Bump
1 parent 9e19ac0 commit faf5629

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

docs/guides/persistence/database-persistence/article.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<span class="property">"cat"</span><span class="operator">:</span> <span class="punctuation">{</span><span class="property">"price"</span><span class="operator">:</span> <span class="number">4</span><span class="punctuation">}</span>
8080
<span class="punctuation">}</span>
8181
<span class="punctuation">}</span>
82-
</code></pre><h3 id="loading-subsets-of-database-tables">Loading subsets of database tables</h3><p>If you are using the tabular mapping, you can specify that only a subset of the data in the database table should be loaded or saved into TinyBase. This is useful for reducing the amount of data that is loaded into memory, or for working with a subset of data that is relevant to the current user.</p><p>Do this by specifying a <code>condition</code> in the <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> configuration. This is a single string argument which is used as a SQL <code>WHERE</code> clause when reading and observing data in the table. The string must include the placeholder <code>$tableName</code> which will be replaced with the name of the table being loaded or saved.</p><p>For example, imagine we have a database table of pets with a flag that indicates if they have been sold or not. Only Felix has:</p><pre><code>db <span class="operator">=</span> <span class="keyword">new</span> <span class="class-name">sqlite3<span class="punctuation">.</span>oo1<span class="punctuation">.</span>DB</span><span class="punctuation">(</span><span class="string">':memory:'</span><span class="punctuation">,</span> <span class="string">'c'</span><span class="punctuation">)</span><span class="punctuation">;</span>
82+
</code></pre><h3 id="loading-subsets-of-database-tables">Loading subsets of database tables</h3><p>If you are using the tabular mapping, you can specify that only a subset of the data in the database table should be loaded into TinyBase. This is useful for reducing the amount of data that is loaded into memory, or for working with a subset of data that is relevant to the current user.</p><p>Do this by specifying a <code>condition</code> in the <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> configuration. This is a single string argument which is used as a SQL <code>WHERE</code> clause when reading and observing data in the table. The string must include the placeholder <code>$tableName</code> which will be replaced with the name of the table being loaded or saved.</p><p>For example, imagine we have a database table of pets with a flag that indicates if they have been sold or not. Only Felix has:</p><pre><code>db <span class="operator">=</span> <span class="keyword">new</span> <span class="class-name">sqlite3<span class="punctuation">.</span>oo1<span class="punctuation">.</span>DB</span><span class="punctuation">(</span><span class="string">':memory:'</span><span class="punctuation">,</span> <span class="string">'c'</span><span class="punctuation">)</span><span class="punctuation">;</span>
8383
db<span class="punctuation">.</span><span class="function">exec</span><span class="punctuation">(</span><span class="template-string"><span class="template-punctuation">`</span><span class="string">CREATE TABLE pets (_id PRIMARY KEY, species, sold);</span><span class="template-punctuation">`</span></span><span class="punctuation">)</span><span class="punctuation">;</span>
8484
db<span class="punctuation">.</span><span class="function">exec</span><span class="punctuation">(</span>
8585
<span class="template-string"><span class="template-punctuation">`</span><span class="string">INSERT INTO pets (_id, species, sold) VALUES </span><span class="template-punctuation">`</span></span> <span class="operator">+</span>

docs/guides/persistence/database-persistence/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<span class="property">"cat"</span><span class="operator">:</span> <span class="punctuation">{</span><span class="property">"price"</span><span class="operator">:</span> <span class="number">4</span><span class="punctuation">}</span>
8080
<span class="punctuation">}</span>
8181
<span class="punctuation">}</span>
82-
</code></pre><h3 id="loading-subsets-of-database-tables">Loading subsets of database tables</h3><p>If you are using the tabular mapping, you can specify that only a subset of the data in the database table should be loaded or saved into TinyBase. This is useful for reducing the amount of data that is loaded into memory, or for working with a subset of data that is relevant to the current user.</p><p>Do this by specifying a <code>condition</code> in the <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> configuration. This is a single string argument which is used as a SQL <code>WHERE</code> clause when reading and observing data in the table. The string must include the placeholder <code>$tableName</code> which will be replaced with the name of the table being loaded or saved.</p><p>For example, imagine we have a database table of pets with a flag that indicates if they have been sold or not. Only Felix has:</p><pre><code>db <span class="operator">=</span> <span class="keyword">new</span> <span class="class-name">sqlite3<span class="punctuation">.</span>oo1<span class="punctuation">.</span>DB</span><span class="punctuation">(</span><span class="string">':memory:'</span><span class="punctuation">,</span> <span class="string">'c'</span><span class="punctuation">)</span><span class="punctuation">;</span>
82+
</code></pre><h3 id="loading-subsets-of-database-tables">Loading subsets of database tables</h3><p>If you are using the tabular mapping, you can specify that only a subset of the data in the database table should be loaded into TinyBase. This is useful for reducing the amount of data that is loaded into memory, or for working with a subset of data that is relevant to the current user.</p><p>Do this by specifying a <code>condition</code> in the <a href="/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> configuration. This is a single string argument which is used as a SQL <code>WHERE</code> clause when reading and observing data in the table. The string must include the placeholder <code>$tableName</code> which will be replaced with the name of the table being loaded or saved.</p><p>For example, imagine we have a database table of pets with a flag that indicates if they have been sold or not. Only Felix has:</p><pre><code>db <span class="operator">=</span> <span class="keyword">new</span> <span class="class-name">sqlite3<span class="punctuation">.</span>oo1<span class="punctuation">.</span>DB</span><span class="punctuation">(</span><span class="string">':memory:'</span><span class="punctuation">,</span> <span class="string">'c'</span><span class="punctuation">)</span><span class="punctuation">;</span>
8383
db<span class="punctuation">.</span><span class="function">exec</span><span class="punctuation">(</span><span class="template-string"><span class="template-punctuation">`</span><span class="string">CREATE TABLE pets (_id PRIMARY KEY, species, sold);</span><span class="template-punctuation">`</span></span><span class="punctuation">)</span><span class="punctuation">;</span>
8484
db<span class="punctuation">.</span><span class="function">exec</span><span class="punctuation">(</span>
8585
<span class="template-string"><span class="template-punctuation">`</span><span class="string">INSERT INTO pets (_id, species, sold) VALUES </span><span class="template-punctuation">`</span></span> <span class="operator">+</span>

site/guides/04_persistence/2_database_persistence.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Each creation function takes a database reference, and a DatabasePersisterConfig
2323
object to describe its configuration. There are two modes for persisting a Store
2424
with a database:
2525

26-
- A JSON serialization of the whole Store, which is stored in a single row of
27-
a table (normally called `tinybase`) within the database. This is
28-
configured by providing a DpcJson object.
26+
- A JSON serialization of the whole Store, which is stored in a single row of a
27+
table (normally called `tinybase`) within the database. This is configured by
28+
providing a DpcJson object.
2929
- A tabular mapping of Table Ids to database table names (and vice-versa).
3030
Values are stored in a separate special table (normally called
3131
`tinybase_values`). This is configured by providing a DpcTabular object.
@@ -191,8 +191,8 @@ section of the configuration.
191191
Do be aware that TinyBase is an in-memory data structure, and so you will not
192192
want to do this if your database tables are particularly large and complex.
193193

194-
Also be very careful when setting the `save` configuration, since it will mean that
195-
TinyBase writes its version of the data back to the database (optionally
194+
Also be very careful when setting the `save` configuration, since it will mean
195+
that TinyBase writes its version of the data back to the database (optionally
196196
removing empty columns). If there is data that does not survive the round trip
197197
(because of schema constraints or data typing), it will be lost.
198198

@@ -286,7 +286,8 @@ console.log(db.exec('SELECT * FROM pets;', {rowMode: 'object'}));
286286
// -> [{_id: 'fido', species: 'dog', sold: 0}, {_id: 'felix', species: 'cat', sold: 1}, {_id: 'cujo', species: 'wolf', sold: 0}]
287287
```
288288

289-
We can configure the Persister to only load and save pets that have not been sold:
289+
We can configure the Persister to only load and save pets that have not been
290+
sold:
290291

291292
```js
292293
const subsetPersister = createSqliteWasmPersister(store, sqlite3, db, {
@@ -307,7 +308,8 @@ console.log(store.getTable('pets'));
307308
// -> {fido: {species: 'dog', sold: 0}, cujo: {species: 'wolf', sold: 0}}
308309
```
309310

310-
And when we change the Store and save it back to the database, only Fido and Cujo are touched:
311+
And when we change the Store and save it back to the database, only Fido and
312+
Cujo are touched:
311313

312314
```js
313315
store.setCell('pets', 'fido', 'species', 'corgi');

0 commit comments

Comments
 (0)