-
Notifications
You must be signed in to change notification settings - Fork 1
/
property.js
68 lines (53 loc) · 1.27 KB
/
property.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var Predicate = require('./predicate');
var pOps=require('./predicate_operation');
var ReturnObj=require('./return')
function Property(config){
if(config){
if(typeof config === 'string'){
this._name=config.toString();
}
else{
this._name=config.name.toString();
if(config.value){
this._value=config.value
}
if(config.node){
this._node=config.node;
}
}
}
else{
this._name='';
}
return this;
}
Property.prototype=pOps.operators; // TODO how to add all operators to property in a better way
Property.prototype.toPredicate = function(){
return new Predicate({left:this.toString()});
}
Property.prototype.getName = function(){
return this._name;
}
Property.prototype.returnObj = function(){
var r=new ReturnObj(this.toString());
return r;
}
Property.prototype.toString = function(){
return this._node._identifier+'.'+this._name;
}
Property.prototype.distinct = function(){
var r=new ReturnObj(this.toString());
r=r.distinct();
return r;
}
Property.prototype.count = function(){
var r=new ReturnObj(this.toString());
r=r.count();
return r;
}
Property.prototype.as = function(str){
var r=new ReturnObj(this.toString());
r=r.as(str);
return r;
}
module.exports =Property;