TinyBase logoTinyBase β

DpcTabularValues

The DpcTabularValues type describes the configuration for handling Values in a database-oriented Persister that is operating in tabular mode.

{
  load?: boolean | DpcTabularValuesIn;
  save?: boolean | DpcTabularValuesIn;
  tableName?: string;
}
TypeDescription
load?boolean | DpcTabularValuesIn

Whether Store Values will be loaded from a database table, or the subset of Value Ids that will be loaded.

save?boolean | DpcTabularValuesIn

Whether Store Values will be saved to a database table, or the subset of Value Ids that will be saved.

tableName?string

The optional name of the database table from and to which the Store Values should be loaded or saved, defaulting to tinybase_values.

Note that both loading and saving of Values from and to the database are disabled by default.

The load and save properties can be set to true to persist all Values, or to a DpcTabularValuesIn array to persist just a subset of Value Ids.

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 the data of two Store Values into a database table called 'my_tinybase_values'.

import type {DatabasePersisterConfig} from 'tinybase';

export const databasePersisterConfig: DatabasePersisterConfig = {
  mode: 'tabular',
  values: {
    load: ['selectedPet', 'open'],
    save: ['selectedPet', 'open'],
    tableName: 'my_tinybase_values',
  },
};

Since

v4.0.0