new SQL(client, gateway)
Creates an instance of SQL.
Parameters:
Name | Type | Description |
---|---|---|
client |
KomadaClient | The Komada Client. |
gateway |
SettingGateway | The SettingGateway instance which initialized this instance. |
Members
-
readonly client :KomadaClient
-
The client this SettingsCache was created with.
-
readonly constants :Object
-
The constants this instance will use to build the SQL schemas.
-
readonly defaults :Object
-
Shortcut for Schema
-
readonly gateway :SettingGateway
-
The gateway which initiated this instance.
-
readonly provider :Resolver
-
The provider this SettingGateway instance uses for the persistent data operations.
-
readonly sanitizer :function
-
Sanitize and prepare the strings for SQL input.
-
readonly schema :Object
-
Shortcut for Schema.
Methods
-
buildSingleSQLSchema(value) → {string}
-
Generate an automatic SQL schema for a single row.
Parameters:
Name Type Description value
Object The Schema object. Returns:
string -
buildSQLSchema(schema) → {Array.<string>}
-
Generate an automatic SQL schema for all rows.
Parameters:
Name Type Description schema
any The Schema Object. Returns:
Array.<string> -
deserializer(data)
-
Deserialize stringified objects.
Parameters:
Name Type Description data
Object The GuildSettings object. -
initDeserialize()
-
Init the deserialization keys for SQL providers.
-
async updateColumns(schema, defaults, key) → {Promise.<boolean>}
-
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. Returns:
Promise.<boolean>