DpcJson
The DpcJson type describes the configuration of a database-oriented Persister operating in serialized JSON mode.
{
  mode: "json";
  storeTableName?: string;
  storeIdColumnName?: string;
  storeColumnName?: string;
  autoLoadIntervalSeconds?: number;
}| Type | Description | |
|---|---|---|
mode | "json" | The mode to be used for persisting the   | 
storeTableName? | string | An optional string which indicates the name of a table in the database which will be used to serialize the   | 
storeIdColumnName? | string | The optional name of the column in the database table that will be used as the   | 
storeColumnName? | string | The optional name of the column in the database table that will be used for the JSON of the   | 
autoLoadIntervalSeconds? | number | How often the   | 
One setting is the storeTableName property, which indicates the name of a table in the database which will be used to serialize the Store content into. It defaults to tinybase.
That table in the database will be given two columns: a primary key column called _id, and one called store. (These column names can be changed using the rowIdColumnName and storeColumnName settings). The Persister will place a single row in this table with _ in the _id column, and the JSON serialization in the store column, something like the following.
> SELECT * FROM tinybase;
+-----+-----------------------------------------------------+
| _id | store                                               |
+-----+-----------------------------------------------------+
| _   | [{"pets":{"fido":{"species":"dog"}}},{"open":true}] |
+-----+-----------------------------------------------------+
The 'Dpc' prefix indicates that this type is used within the DatabasePersisterConfig type.
Example
When applied to a database Persister, this DatabasePersisterConfig will load and save a JSON serialization from and to a table called tinybase_json.
import type {DatabasePersisterConfig} from 'tinybase';
export const databasePersisterConfig: DatabasePersisterConfig = {
  mode: 'json',
  storeTableName: 'tinybase_json',
};
Since
v4.0.0