forked from brianc/node-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcast.js
More file actions
27 lines (23 loc) · 781 Bytes
/
cast.js
File metadata and controls
27 lines (23 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
'use strict';
var _ = require('lodash');
var Node = require('./index');
var valueExpressionMixin = require('./valueExpression');
var valueExpressionMixed = false;
var CastNode = Node.define({
type: 'CAST',
constructor: function(value, dataType) {
Node.call(this);
this.value = value;
this.dataType = dataType;
// Delay mixin to runtime, when all nodes have been defined, and
// mixin only once. ValueExpressionMixin has circular dependencies.
if (!valueExpressionMixed) {
valueExpressionMixed = true;
_.extend(CastNode.prototype, valueExpressionMixin());
}
}
});
// allow aliasing
var AliasNode = require('./alias');
_.extend(CastNode.prototype, AliasNode.AliasMixin);
module.exports = CastNode;