Providers are special pieces that give you easy access to various data storage systems
using a consistent and predictable set of methods
Example
The following structure is needed for SettingGateway compatibility.
exports.hasTable = (table) => { // code here };
exports.createTable = (table) => { // code here };
exports.getAll = (table) => { // code here };
exports.get = (table, id) => { // code here };
exports.create = (table, id, document) => { // code here };
exports.delete = (table, id) => { // code here };
exports.update = (table, id, document) => { // code here };
exports.replace = (table, id, document) => { // code here };
exports.conf = {};
Members
-
static conf :Conf
-
An object that configures the provider.
Example
exports.conf = { enabled: true, moduleName: "json", priority: 0 };
Methods
-
static create(table, id, document) → {Promise.<*>}
-
Create a new entry into a table.
Parameters:
Name Type Description tablestring The name of the table to update. idstring The ID for the new entry. documentObject A JSON object. Returns:
Promise.<*> -
static createTable(table) → {Promise.<*>}
-
Create a new table.
Parameters:
Name Type Description tablestring The name for the new table. Returns:
Promise.<*> -
static delete(table, id) → {Promise.<Array.<{}>>}
-
Delete an entry from a table.
Parameters:
Name Type Description tablestring The name of the table to update. idstring The ID of the entry to delete. Returns:
Promise.<Array.<{}>> -
static get(table, id) → {Promise.<Array.<{}>>}
-
Get an entry from a table.
Parameters:
Name Type Description tablestring The name of the table to fetch from. idstring The ID of the entry to get. Returns:
Promise.<Array.<{}>> -
static getAll(table) → {Promise.<Array.<{}>>}
-
Get all entries from a table.
Parameters:
Name Type Description tablestring The name of the table to fetch from. Returns:
Promise.<Array.<{}>> -
static hasTable(table) → {Promise.<boolean>}
-
Checks if a table exists.
Parameters:
Name Type Description tablestring The name of the table you want to check. Returns:
Promise.<boolean> -
static replace(table, id, document) → {Promise.<*>}
-
Replace an entry from a table.
Parameters:
Name Type Description tablestring The name of the table to update. idstring The ID of the entry to update. documentObject The new JSON object for the document. Returns:
Promise.<*> -
static update(table, id, document) → {Promise.<*>}
-
Update an entry from a table.
Parameters:
Name Type Description tablestring The name of the table to update. idstring The ID of the entry to update. documentObject A JSON object. Returns:
Promise.<*>