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

Commit c3ee1344 by Sascha Depold

preparation for model + mixin

1 parent f559cf07
/*
Defines Mixin for all models.
*/
var Associations = module.exports = {
classMethods: {
hasOne: function(associationName, associatedModel, options) {
},
hasMany: function(associationName, associatedModel, options) {
},
belongsTo: function(associationName, associatedModel, options) {
}
},
instanceMethods: {
}
}
\ No newline at end of file
var Utils = require("./utils")
, Mixin = require("./associations")
/*
Defines the connection between data and the sql table.
Parameters:
- name: the name of the model
- attributes: A name-datatype-hash -> {name: 'VARCHAR(255)', id: "INT"}
Options:
-
*/
var Model = module.exports = function(name, attributes, options) {
this.name = name
this.attributes = attributes
this.options = options || {}
}
var classMethods = {
sync: function() {
},
drop: function() {
}
}
var instanceMethods = {
}
Utils._.map(classMethods, function(fct, name) { Model[name] = fct })
Utils._.map(instanceMethods, function(fct, name) { Model.prototype[name] = fct})
Utils._.map(Mixin.classMethods, function(fct, name) { Model[name] = fct })
Utils._.map(Mixin.instanceMethods, function(fct, name) { Model.prototype[name] = fct})
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!