| 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 |