UNPKG

neo4j

Version:

Neo4j driver (REST API client) for Node.js

48 lines (38 loc) 1.65 kB
// Generated by CoffeeScript 1.8.0 (function() { var Constraint, lib; lib = require('../package.json'); module.exports = Constraint = (function() { function Constraint(opts) { if (opts == null) { opts = {}; } this.label = opts.label, this.property = opts.property; } Constraint.prototype.equals = function(other) { return (other instanceof Constraint) && (this.label === other.label) && (this.property === other.property); }; Constraint.prototype.toString = function() { var node; node = this.label.toLowerCase(); return "CONSTRAINT ON (" + node + ":" + this.label + ") ASSERT " + node + "." + this.property + " IS UNIQUE"; }; Constraint._fromRaw = function(obj) { var label, property, property_keys, type; type = obj.type, label = obj.label, property_keys = obj.property_keys; if (type !== 'UNIQUENESS') { console.warn("Unrecognized constraint type encountered: " + type + ". node-neo4j v" + lib.version + " doesn’t know how to handle these. Continuing as if it’s a UNIQUENESS constraint..."); } if (property_keys.length > 1) { console.warn("Constraint (on :" + label + ") with " + property_keys.length + " property keys encountered: " + (property_keys.join(', ')) + ". node-neo4j v" + lib.version + " doesn’t know how to handle these. Continuing with only the first one."); } property = property_keys[0]; return new Constraint({ label: label, property: property }); }; return Constraint; })(); }).call(this); //# sourceMappingURL=Constraint.js.map