forked from TokyoFarmer/node-sql-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolumn.js
More file actions
28 lines (25 loc) · 781 Bytes
/
column.js
File metadata and controls
28 lines (25 loc) · 781 Bytes
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
'use strict';
var Node = require('./');
var ColumnNode = module.exports = Node.define({
type: 'COLUMN',
constructor: function(config) {
Node.call(this);
// implement copy constructor functionality
this.name = config.name;
this.alias = config.alias;
this.star = config.star;
this.asArray = config.asArray;
this.aggregator = config.aggregator;
this.table = config.table;
this.value = config.getValue ? config.getValue() : config.value;
this.dataType = config.dataType;
this.distinct = config.distinct;
this.primaryKey = config.primaryKey;
},
as: function(alias) {
// create a new node with the alias
var node = new ColumnNode(this);
node.alias = alias;
return node;
}
});