MCPcopy
hub / github.com/sequelize/sequelize / format

Method format

src/dialects/abstract/query-generator.js:1171–1188  ·  view source on GitHub ↗
(value, field, options, bindParam)

Source from the content-addressed store, hash-verified

1169 @private
1170 */
1171 format(value, field, options, bindParam) {
1172 options = options || {};
1173
1174 if (value !== null && value !== undefined) {
1175 if (value instanceof Utils.SequelizeMethod) {
1176 throw new Error('Cannot pass SequelizeMethod as a bind parameter - use escape instead');
1177 }
1178 if (field && field.type) {
1179 this.validate(value, field, options);
1180
1181 if (field.type.bindParam) {
1182 return field.type.bindParam(value, { escape: _.identity, field, timezone: this.options.timezone, operation: options.operation, bindParam });
1183 }
1184 }
1185 }
1186
1187 return bindParam(value);
1188 }
1189
1190 /*
1191 Validate a value against a field specification

Callers 15

insertQueryMethod · 0.95
updateQueryMethod · 0.95
whereItemQueryMethod · 0.95
data-types.test.jsFile · 0.80
utils.test.jsFile · 0.80
model.test.jsFile · 0.80
formatDateFunction · 0.80
smoke.test.jsFile · 0.80
data-types.test.jsFile · 0.80
validateMethod · 0.80

Calls 2

validateMethod · 0.95
bindParamMethod · 0.45

Tested by 1

formatDateFunction · 0.64