49 lines
718 B
JavaScript
49 lines
718 B
JavaScript
|
|
var Expr = require('./expr');
|
|
var ListHolder = require('./list-holder');
|
|
|
|
/**
|
|
* The equivalent of a SQL function.
|
|
*/
|
|
module.exports = new Class({
|
|
Extends: Expr
|
|
,Tag: 'sql-function'
|
|
,Implements: ListHolder
|
|
,Properties: {
|
|
/**
|
|
* The function name.
|
|
*/
|
|
name: {
|
|
type: String
|
|
,value: null
|
|
},
|
|
/**
|
|
* The function schema.
|
|
*/
|
|
schema: {
|
|
type: String
|
|
,value: null
|
|
},
|
|
/**
|
|
* The function parameters.
|
|
*/
|
|
params: {
|
|
type: Array
|
|
,set(x) {
|
|
this.list = x;
|
|
}
|
|
,get() {
|
|
return this.list;
|
|
}
|
|
}
|
|
}
|
|
|
|
,render(params) {
|
|
return this.renderPreIdent(this.schema)
|
|
+ this.renderIdent(this.name)
|
|
+ '('
|
|
+ this.renderListWs(this.list, params, ', ')
|
|
+ ')';
|
|
}
|
|
});
|