不要怂,就是干,撸起袖子干!

Commit 78c2475a by sdepold

moved getters to the top of the file

1 parent 0aaef45b
Showing with 18 additions and 18 deletions
......@@ -26,16 +26,6 @@ module.exports = (function() {
this.validate = this.options.validate || {}
}
ModelFactory.prototype.init = function(modelManager) {
this.modelManager = modelManager
addDefaultAttributes.call(this)
addOptionalClassMethods.call(this)
findAutoIncrementField.call(this)
return this
}
Object.defineProperty(ModelFactory.prototype, 'attributes', {
get: function() {
return this.QueryGenerator.attributesToSQL(this.rawAttributes)
......@@ -50,6 +40,24 @@ module.exports = (function() {
get: function() { return this.QueryInterface.QueryGenerator }
})
Object.defineProperty(ModelFactory.prototype, 'primaryKeyCount', {
get: function() { return Utils._.keys(this.primaryKeys).length }
})
Object.defineProperty(ModelFactory.prototype, 'hasPrimaryKeys', {
get: function() { return this.primaryKeyCount > 0 }
})
ModelFactory.prototype.init = function(modelManager) {
this.modelManager = modelManager
addDefaultAttributes.call(this)
addOptionalClassMethods.call(this)
findAutoIncrementField.call(this)
return this
}
ModelFactory.prototype.sync = function(options) {
options = Utils.merge(options || {}, this.options)
......@@ -177,14 +185,6 @@ module.exports = (function() {
return result
})
ModelFactory.prototype.__defineGetter__('primaryKeyCount', function() {
return Utils._.keys(this.primaryKeys).length
})
ModelFactory.prototype.__defineGetter__('hasPrimaryKeys', function() {
return this.primaryKeyCount > 0
})
// private
var query = function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!