2022-05-30 01:30:33 +00:00
|
|
|
|
2022-06-06 08:53:59 +00:00
|
|
|
var Target = require('./target');
|
|
|
|
var ListHolder = require('./list-holder');
|
2022-05-30 01:30:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The equivalent of a SQL join.
|
|
|
|
*/
|
2022-06-06 08:53:59 +00:00
|
|
|
var Klass = new Class();
|
2022-05-30 01:30:33 +00:00
|
|
|
module.exports = Klass;
|
|
|
|
|
|
|
|
var Type = {
|
|
|
|
INNER : 0,
|
|
|
|
LEFT : 1,
|
|
|
|
RIGHT : 2
|
|
|
|
};
|
|
|
|
|
2022-06-06 08:53:59 +00:00
|
|
|
Klass.extend({
|
2022-05-30 01:30:33 +00:00
|
|
|
Type: Type
|
|
|
|
});
|
|
|
|
|
2022-06-06 08:53:59 +00:00
|
|
|
Klass.implement({
|
2022-05-30 01:30:33 +00:00
|
|
|
Extends: Target
|
|
|
|
,Implements: ListHolder
|
|
|
|
,Tag: 'sql-join'
|
2022-06-06 08:53:59 +00:00
|
|
|
,Properties: {
|
2022-05-30 01:30:33 +00:00
|
|
|
/**
|
|
|
|
* The right targets.
|
|
|
|
*/
|
2022-06-06 08:53:59 +00:00
|
|
|
targets: {
|
2022-05-30 01:30:33 +00:00
|
|
|
type: Array
|
2022-06-06 08:53:59 +00:00
|
|
|
,set: function(x) {
|
2022-05-30 01:30:33 +00:00
|
|
|
this.list = x;
|
|
|
|
}
|
2022-06-06 08:53:59 +00:00
|
|
|
,get: function() {
|
2022-05-30 01:30:33 +00:00
|
|
|
return this.list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-06 08:53:59 +00:00
|
|
|
,render: function(params) {
|
2022-05-30 01:30:33 +00:00
|
|
|
return '('
|
2022-06-06 08:53:59 +00:00
|
|
|
+ this.target.render(params)
|
2022-05-30 01:30:33 +00:00
|
|
|
+ ' '
|
2022-06-06 08:53:59 +00:00
|
|
|
+ this.renderList(this.list, params)
|
2022-05-30 01:30:33 +00:00
|
|
|
+ ')';
|
|
|
|
}
|
|
|
|
});
|