Browse Source

Column doesn't need to use delayed runtime valueExpressionMixin

dev
Di Wu 12 years ago
parent
commit
d31c6b3a97
  1. 11
      lib/column.js

11
lib/column.js

@ -7,7 +7,6 @@ var OrderByColumnNode = require(__dirname + '/node/orderByColumn');
var UnaryNode = require(__dirname + '/node/unary');
var TextNode = require(__dirname + '/node/text');
var valueExpressionMixed = false;
var Column = function(config) {
this.table = config.table;
for(var name in config) {
@ -20,15 +19,11 @@ var Column = function(config) {
direction: new TextNode('DESC')
});
this.dataType = config.dataType;
// Delay mixin to runtime, when all nodes have been defined, and
// mixin only once. This is to avoid circular dependency in
// CommonJS.
if (!valueExpressionMixed) {
valueExpressionMixed = true;
_.extend(Column.prototype, valueExpressionMixin());
}
};
// mix in value expression
_.extend(Column.prototype, valueExpressionMixin());
var contextify = function(base) {
var context = Object.create(Column.prototype);
Object.keys(base).forEach(function (key) {

Loading…
Cancel
Save