new SQL(client, gateway)
Creates an instance of SQL.
Parameters:
Name | Type | Description |
---|---|---|
client |
KlasaClient | The Klasa Client. |
gateway |
SettingGateway | The SettingGateway instance which initialized this instance. |
- Source:
- lib/settings/SQL.js#L21
Properties
-
<readonly> constants :Object
-
The constants this instance will use to build the SQL schemas.
Type:
- Object
- Source:
- lib/settings/SQL.js#L111
-
<readonly> defaults :Object
-
Shortcut for Schema
Type:
- Object
- Source:
- lib/settings/SQL.js#L138
-
<readonly> provider :Provider
-
The provider this SettingGateway instance uses for the persistent data operations.
Type:
- Source:
- lib/settings/SQL.js#L147
-
<readonly> sanitizer :function
-
Sanitize and prepare the strings for SQL input.
Type:
- function
- Source:
- lib/settings/SQL.js#L120
-
<readonly> schema :Object
-
Shortcut for Schema.
Type:
- Object
- Source:
- lib/settings/SQL.js#L129
Methods
-
buildSingleSQLSchema(value)
-
Generate an automatic SQL schema for a single row.
Parameters:
Name Type Description value
Object The Schema object. - Source:
- lib/settings/SQL.js#L42
Returns:
- Type
- string
-
buildSQLSchema(schema)
-
Generate an automatic SQL schema for all rows.
Parameters:
Name Type Description schema
any The Schema Object. - Source:
- lib/settings/SQL.js#L53
Returns:
- Type
- Array.<string>
-
deserializer(data)
-
Deserialize stringified objects.
Parameters:
Name Type Description data
Object The Settings object. - Source:
- lib/settings/SQL.js#L75
-
initDeserialize()
-
Init the deserialization keys for SQL providers.
- Source:
- lib/settings/SQL.js#L64
-
<async> updateColumns(schema, defaults, key)
-
Create/Remove columns from a SQL database, by the current Schema.
Parameters:
Name Type Description schema
Object The Schema object. defaults
Object The Schema object. key
string The key which is updated. - Source:
- lib/settings/SQL.js#L91
Returns:
- Type
- boolean