plywood
Version:
A query planner and executor
48 lines (47 loc) • 2.12 kB
JavaScript
import { __extends } from "tslib";
import { Ip } from '../datatypes/ip';
import { ChainableExpression, Expression } from './baseExpression';
var IpSearchExpression = (function (_super) {
__extends(IpSearchExpression, _super);
function IpSearchExpression(parameters) {
var _this = _super.call(this, parameters, dummyObject) || this;
_this.ipSearchType = 'ip';
_this._ensureOp('ipSearch');
_this._checkOperandTypes('IP');
_this.ipToSearch = Ip.fromString(parameters.ipToSearch.ip);
_this.ipSearchType = parameters.ipSearchType;
_this.type = 'BOOLEAN';
return _this;
}
IpSearchExpression.fromJS = function (parameters) {
var value = ChainableExpression.jsToValue(parameters);
value.ipToSearch = parameters.ipToSearch;
value.ipSearchType = parameters.ipSearchType;
return new IpSearchExpression(value);
};
IpSearchExpression.prototype.valueOf = function () {
var value = _super.prototype.valueOf.call(this);
value.ipToSearch = Ip.fromString(this.ipToSearch.ip);
value.ipSearchType = this.ipSearchType;
return value;
};
IpSearchExpression.prototype.equals = function (other) {
var _a, _b;
return (_super.prototype.equals.call(this, other) &&
((_a = this.ipToSearch) === null || _a === void 0 ? void 0 : _a.ip) === ((_b = other.ipToSearch) === null || _b === void 0 ? void 0 : _b.ip) &&
this.ipSearchType === other.ipSearchType);
};
IpSearchExpression.prototype.toJS = function () {
var js = _super.prototype.toJS.call(this);
js.ipToSearch = this.ipToSearch;
js.ipSearchType = this.ipSearchType;
return js;
};
IpSearchExpression.prototype._getSQLChainableHelper = function (dialect, operandSQL) {
return dialect.ipSearchExpression(operandSQL, this.ipToSearch.toString(), this.ipSearchType);
};
IpSearchExpression.op = 'IpSearch';
return IpSearchExpression;
}(ChainableExpression));
export { IpSearchExpression };
Expression.register(IpSearchExpression);