不要怂,就是干,撸起袖子干!

Commit a27de748 by Jan Aagaard Meier

[ci skip] 📝 Add transaction option to api docs for a couple of methods. Closes #4136

1 parent 53795052
Showing with 15 additions and 12 deletions
...@@ -1333,13 +1333,14 @@ Model.prototype.aggregate = function(field, aggregateFunction, options) { ...@@ -1333,13 +1333,14 @@ Model.prototype.aggregate = function(field, aggregateFunction, options) {
* *
* If you provide an `include` option, the number of matching associations will be counted instead. * If you provide an `include` option, the number of matching associations will be counted instead.
* *
* @param {Object} [options] * @param {Object} [options]
* @param {Object} [options.where] A hash of search attributes. * @param {Object} [options.where] A hash of search attributes.
* @param {Object} [options.include] Include options. See `find` for details * @param {Object} [options.include] Include options. See `find` for details
* @param {boolean} [options.distinct] Apply COUNT(DISTINCT(col)) * @param {boolean} [options.distinct] Apply COUNT(DISTINCT(col))
* @param {Object} [options.attributes] Used in conjustion with `group` * @param {Object} [options.attributes] Used in conjustion with `group`
* @param {Object} [options.group] For creating complex counts. Will return multiple rows as needed. * @param {Object} [options.group] For creating complex counts. Will return multiple rows as needed.
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Transaction} [options.transaction] Transaction to run query under
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* *
* @return {Promise<Integer>} * @return {Promise<Integer>}
*/ */
...@@ -1725,11 +1726,12 @@ Model.prototype.findOrCreate = function(options) { ...@@ -1725,11 +1726,12 @@ Model.prototype.findOrCreate = function(options) {
* *
* **Note** that SQLite returns undefined for created, no matter if the row was created or updated. This is because SQLite always runs INSERT OR IGNORE + UPDATE, in a single query, so there is no way to know whether the row was inserted or not. * **Note** that SQLite returns undefined for created, no matter if the row was created or updated. This is because SQLite always runs INSERT OR IGNORE + UPDATE, in a single query, so there is no way to know whether the row was inserted or not.
* *
* @param {Object} values * @param {Object} values
* @param {Object} [options] * @param {Object} [options]
* @param {Boolean} [options.validate=true] Run validations before the row is inserted * @param {Boolean} [options.validate=true] Run validations before the row is inserted
* @param {Array} [options.fields=Object.keys(this.attributes)] The fields to insert / update. Defaults to all fields * @param {Array} [options.fields=Object.keys(this.attributes)] The fields to insert / update. Defaults to all fields
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Transaction} [options.transaction] Transaction to run query under
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* *
* @alias insertOrUpdate * @alias insertOrUpdate
* @return {Promise<created>} Returns a boolean indicating whether the row was created or updated. * @return {Promise<created>} Returns a boolean indicating whether the row was created or updated.
...@@ -1937,6 +1939,7 @@ Model.prototype.bulkCreate = function(records, options) { ...@@ -1937,6 +1939,7 @@ Model.prototype.bulkCreate = function(records, options) {
* @param {object} [options] The options passed to Model.destroy in addition to truncate * @param {object} [options] The options passed to Model.destroy in addition to truncate
* @param {Boolean|function} [options.transaction] Transaction to run query under * @param {Boolean|function} [options.transaction] Transaction to run query under
* @param {Boolean|function} [options.cascade = false] Only used in conjuction with TRUNCATE. Truncates all tables that have foreign-key references to the named table, or to any tables added to the group due to CASCADE. * @param {Boolean|function} [options.cascade = false] Only used in conjuction with TRUNCATE. Truncates all tables that have foreign-key references to the named table, or to any tables added to the group due to CASCADE.
* @param {Transaction} [options.transaction] Transaction to run query under
* @param {Boolean|function} [options.logging] A function that logs sql queries, or false for no logging * @param {Boolean|function} [options.logging] A function that logs sql queries, or false for no logging
* @return {Promise} * @return {Promise}
* *
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!