ProviderSQL

Some providers are SQL, and due to the No-SQL environment that exists in SettingGateway, they require extra methods/properties to work. All the previous methods are required to work.
Example

SQL Compatibility

exports.updateColumns = (table, columns, schema) => { // code here };
exports.serialize = (data) => { // code here };
exports.sanitize = (string) => { // code here };
exports.CONSTANTS = {};

Members

static CONSTANTS

An object that helps the SQL class creating compatible schemas for the provider.
Properties:
Name Type Description
String string The SQL compatible string datatype.
Integer string The SQL compatible integer datatype.
Float string The SQL compatible float datatype.
Example
exports.CONSTANTS = {
  String: "TEXT",
  Integer: "INTEGER",
  Float: "INTEGER",
  AutoID: "INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE",
  Timestamp: "DATETIME",
  AutoTS: "DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL",
};

Methods

static sanitize(string) → {string}

Sanitize strings to be storable into the SQL database.
Parameters:
Name Type Description
string * An object or string.
Returns:
string

static serialize(data) → {Object}

Transform NoSQL queries into SQL.
Parameters:
Name Type Description
data Object The object.
Returns:
Object

static updateColumns(table, columns, schema) → {boolean}

Update the columns from a table (All the data is provided by the SQL class).
Parameters:
Name Type Description
table string The name of the table.
columns Array.<string> Array of columns.
schema Array.<array> Tuples of keys/values from the schema.
Returns:
boolean