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