azurite
Version:
An open source Azure Storage API compatible server
34 lines • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const BinaryOperatorNode_1 = tslib_1.__importDefault(require("./BinaryOperatorNode"));
const ValueNode_1 = tslib_1.__importDefault(require("./ValueNode"));
/**
* Represents a logical equality operation between two nodes (the `eq` query operator).
*
* This is used in queries which resemble the following:
*
* PartitionKey eq 'foo'
*
* In this case, the `EqualsNode` would be the root node, with the left and right nodes
* corresponding to the identifier `PartitionKey` and the constant `foo`, respectively.
*
* NOTE: This operation includes backwards compatibility for the `guid` type hint, since
* earlier versions of Azurite stored guid values in their raw string format.
*/
class EqualsNode extends BinaryOperatorNode_1.default {
get name() {
return `eq`;
}
evaluate(context) {
if (this.left instanceof ValueNode_1.default) {
return this.left.compare(context, this.right) === 0;
}
if (this.right instanceof ValueNode_1.default) {
return this.right.compare(context, this.left) === 0;
}
return this.left.evaluate(context) === this.right.evaluate(context);
}
}
exports.default = EqualsNode;
//# sourceMappingURL=EqualsNode.js.map