You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
</code></pre><h3id="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 <ahref="/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 <spanclass="operator">=</span><spanclass="keyword">new</span><spanclass="class-name">sqlite3<spanclass="punctuation">.</span>oo1<spanclass="punctuation">.</span>DB</span><spanclass="punctuation">(</span><spanclass="string">':memory:'</span><spanclass="punctuation">,</span><spanclass="string">'c'</span><spanclass="punctuation">)</span><spanclass="punctuation">;</span>
82
+
</code></pre><h3id="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 <ahref="/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 <spanclass="operator">=</span><spanclass="keyword">new</span><spanclass="class-name">sqlite3<spanclass="punctuation">.</span>oo1<spanclass="punctuation">.</span>DB</span><spanclass="punctuation">(</span><spanclass="string">':memory:'</span><spanclass="punctuation">,</span><spanclass="string">'c'</span><spanclass="punctuation">)</span><spanclass="punctuation">;</span>
</code></pre><h3id="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 <ahref="/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 <spanclass="operator">=</span><spanclass="keyword">new</span><spanclass="class-name">sqlite3<spanclass="punctuation">.</span>oo1<spanclass="punctuation">.</span>DB</span><spanclass="punctuation">(</span><spanclass="string">':memory:'</span><spanclass="punctuation">,</span><spanclass="string">'c'</span><spanclass="punctuation">)</span><spanclass="punctuation">;</span>
82
+
</code></pre><h3id="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 <ahref="/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 <spanclass="operator">=</span><spanclass="keyword">new</span><spanclass="class-name">sqlite3<spanclass="punctuation">.</span>oo1<spanclass="punctuation">.</span>DB</span><spanclass="punctuation">(</span><spanclass="string">':memory:'</span><spanclass="punctuation">,</span><spanclass="string">'c'</span><spanclass="punctuation">)</span><spanclass="punctuation">;</span>
0 commit comments