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