thinkjs/lib/Extend/Model/AdvModel.class.js
2014-01-08 13:34:50 +08:00

29 lines
759 B
JavaScript

/**
* 高级模型
* @return {[type]} [description]
*/
module.exports = Model(function(){
return {
/**
* 关联定义
* @type {Object}
*/
relation: {},
/**
* 返回数据里含有count信息的查询
* @return {[type]} [description]
*/
countSelect: function(options){
var self = this;
return this.parseOptions(options).then(function(options){
var result = self.db.select(options);
return getPromise(self._afterSelect(result, options)).then(function(result){
if (result === false) {
return getPromise("_afterSelect return false", true);
};
return result;
})
});
}
}
})