MCPcopy
hub / github.com/sequelize/sequelize / create

Method create

lib/model.js:2223–2233  ·  lib/model.js::Model.create

* Builds a new model instance and calls save on it. * * @see * {@link Model.build} * @see * {@link Model.save} * * @param {object} values Hash of data values to create new record with * @param {object} [options] Build

(values, options)

Source from the content-addressed store, hash-verified

2221 *
2222 */
2223 static async create(values, options) {
2224 options = Utils.cloneDeep(options || {});
2225
2226 return await this.build(values, {
2227 isNewRecord: true,
2228 attributes: options.fields,
2229 include: options.include,
2230 raw: options.raw,
2231 silent: options.silent
2232 }).save(options);
2233 }
2234
2235 /**
2236 * Find a row that matches the query, or build (but don't save) the row if none is found.

Callers 15

findOrCreateMethod · 0.95
findCreateFindMethod · 0.95
sscce.jsFile · 0.45
create.tsFile · 0.45
transFunction · 0.45
testFunction · 0.45
stuffFunction · 0.45
doStuffWithUserFunction · 0.45
doStuffWithUserModelFunction · 0.45
saveMethod · 0.45
error.test.jsFile · 0.45

Calls 2

buildMethod · 0.95
saveMethod · 0.80

Tested by 11

testFunction · 0.36
testSuccessFunction · 0.36
testAsyncFunction · 0.36
updateFunction · 0.36
verifyDeadlockFunction · 0.36
newTransactionFuncFunction · 0.36
executeTestFunction · 0.36
checkTimezoneParsingFunction · 0.36
describeDeferrableTestFunction · 0.36