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

Method format

lib/dialects/abstract/query-generator.js:1048–1065  ·  lib/dialects/abstract/query-generator.js::QueryGenerator.format
(value, field, options, bindParam)

Source from the content-addressed store, hash-verified

1046 @private
1047 */
1048 format(value, field, options, bindParam) {
1049 options = options || {};
1050
1051 if (value !== null && value !== undefined) {
1052 if (value instanceof Utils.SequelizeMethod) {
1053 throw new Error(class="st">'Cannot pass SequelizeMethod as a bind parameter - use escape instead');
1054 }
1055 if (field && field.type) {
1056 this.validate(value, field, options);
1057
1058 if (field.type.bindParam) {
1059 return field.type.bindParam(value, { escape: _.identity, field, timezone: this.options.timezone, operation: options.operation, bindParam });
1060 }
1061 }
1062 }
1063
1064 return bindParam(value);
1065 }
1066
1067 /*
1068 Validate a value against a field specification

Callers 15

insertQueryMethod · 0.95
updateQueryMethod · 0.95
whereItemQueryMethod · 0.95
queryMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80

Calls 2

validateMethod · 0.95
bindParamMethod · 0.45

Tested by 1

formatDateFunction · 0.64