plywood
Version:
A query planner and executor
26 lines (25 loc) • 1.03 kB
JavaScript
import { __extends } from "tslib";
import { ChainableExpression, Expression } from './baseExpression';
var LengthExpression = (function (_super) {
__extends(LengthExpression, _super);
function LengthExpression(parameters) {
var _this = _super.call(this, parameters, dummyObject) || this;
_this._ensureOp('length');
_this._checkOperandTypes('STRING');
_this.type = 'NUMBER';
return _this;
}
LengthExpression.fromJS = function (parameters) {
return new LengthExpression(ChainableExpression.jsToValue(parameters));
};
LengthExpression.prototype._calcChainableHelper = function (operandValue) {
return operandValue ? operandValue.length : null;
};
LengthExpression.prototype._getSQLChainableHelper = function (dialect, operandSQL) {
return dialect.lengthExpression(operandSQL);
};
LengthExpression.op = 'Length';
return LengthExpression;
}(ChainableExpression));
export { LengthExpression };
Expression.register(LengthExpression);