MCPcopy
hub / github.com/sequelize/sequelize / bulkUpdate

Method bulkUpdate

src/dialects/abstract/query-interface.js:920–931  ·  view source on GitHub ↗

* Update multiple records of a table * * @example * queryInterface.bulkUpdate('roles', { * label: 'admin', * }, { * userType: 3, * }, * ); * * @param {string} tableName Table name to update * @param {object} values Values to be inserted, mapped

(tableName, values, identifier, options, attributes)

Source from the content-addressed store, hash-verified

918 * @returns {Promise}
919 */
920 async bulkUpdate(tableName, values, identifier, options, attributes) {
921 options = Utils.cloneDeep(options);
922 if (typeof identifier === 'object') identifier = Utils.cloneDeep(identifier);
923
924 const sql = this.queryGenerator.updateQuery(tableName, values, identifier, options, attributes);
925 const table = _.isObject(tableName) ? tableName : { tableName };
926 const model = options.model ? options.model : _.find(this.sequelize.modelManager.models, { tableName: table.tableName });
927
928 options.type = QueryTypes.BULKUPDATE;
929 options.model = model;
930 return await this.sequelize.query(sql, options);
931 }
932
933 async delete(instance, tableName, identifier, options) {
934 const cascades = [];

Callers 4

testFunction · 0.80
destroyMethod · 0.80
restoreMethod · 0.80
updateMethod · 0.80

Calls 2

updateQueryMethod · 0.45
queryMethod · 0.45

Tested by 1

testFunction · 0.64