48 lines
626 B
JavaScript
48 lines
626 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(x) {
|
|
this.list = x;
|
|
}
|
|
,get() {
|
|
return this.list;
|
|
}
|
|
}
|
|
}
|
|
|
|
,render(params) {
|
|
return '('
|
|
+ this.target.render(params)
|
|
+ ' '
|
|
+ this.renderList(this.list, params)
|
|
+ ')';
|
|
}
|
|
});
|