sedk-neo4j
Version:
Cypher builder and validator for Neo4j
27 lines • 914 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MatchStep = void 0;
const BaseStep_1 = require("./BaseStep");
const ReturnStep_1 = require("./ReturnStep");
const Variable_1 = require("../Variable");
class MatchStep extends BaseStep_1.BaseStep {
constructor(prevStep, matchItems) {
super(prevStep);
this.matchItems = matchItems;
if (matchItems.length === 0) {
throw new Error('No variable or labels provided');
}
}
toString() {
const matchArray = this.matchItems.map(it => it.getStmt());
if (!(this.matchItems[0] instanceof Variable_1.Variable)) {
matchArray.unshift('');
}
return `MATCH (${matchArray.join(':')})`;
}
return(...items) {
return new ReturnStep_1.ReturnStep(this, items);
}
}
exports.MatchStep = MatchStep;
//# sourceMappingURL=MatchStep.js.map