Class: DeleteModel

DeleteModel

A Query class that allows for quickly deleting of models by ID.

Constructor

new DeleteModel()

Source:

Extends

Members

database

Properties:
Name Type Description
database Database A database instance.
escaper Escaper An instance of an Escaper class that can escape query parts.
queryExecuter QueryExecuter An instance of a QueryExecuter that can execute CRUD operations.
Inherited From:
Source:

queries :Array.<Query>

An array of Query instances, one per model.
Type:
Inherited From:
Source:

Methods

buildQuery() → {Query~QueryMeta}

Build the query.
Inherited From:
Source:
Returns:
The string-representation of the query to execute along with any query parameters.
Type
Query~QueryMeta

createQuery(meta) → {Delete}

Create a Delete instance.
Parameters:
Name Type Description
meta ModelTraverse~ModelMeta A meta object as created by the modelTraverse class.
Overrides:
Source:
Returns:
A Delete Query instance representing the DELETE query.
Type
Delete

execute() → {Promise.<object>}

Execute the query.
Inherited From:
Source:
Returns:
A promise that will be resolved with an object. The object will have an affectedRows property. If an error occurs when executing a query, the promise shall be rejected with the error unmodified.
Type
Promise.<object>

toString() → {string}

Create the SQL for each query.
Inherited From:
Source:
Returns:
A SQL string representing the mutation queries.
Type
string