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

Commit 76c5ac79 by sdepold

added abstract query class

1 parent 7a1e992c
...@@ -14,7 +14,7 @@ module.exports = (function() { ...@@ -14,7 +14,7 @@ module.exports = (function() {
this.bindClientFunction = function(err) { onFailure.call(self, err) } this.bindClientFunction = function(err) { onFailure.call(self, err) }
} }
Utils.addEventEmitter(Query) Utils._.extend(Query.prototype, require("../query").prototype)
Query.prototype.run = function(sql) { Query.prototype.run = function(sql) {
var self = this var self = this
...@@ -33,16 +33,6 @@ module.exports = (function() { ...@@ -33,16 +33,6 @@ module.exports = (function() {
return this return this
} }
Query.prototype.success = Query.prototype.ok = function(fct) {
this.on('success', fct)
return this
}
Query.prototype.failure = Query.prototype.fail = Query.prototype.error = function(fct) {
this.on('failure', fct)
return this
}
//private //private
var bindClient = function() { var bindClient = function() {
......
var Utils = require("../utils")
module.exports = (function() {
var Query = function(database, callee, options) {
throw new Error('Constructor was not overwritten!')
}
Utils.addEventEmitter(Query)
Query.prototype.run = function(sql) {
throw new Error("The run method wasn't overwritten!")
}
Query.prototype.success = Query.prototype.ok = function(fct) {
this.on('success', fct)
return this
}
Query.prototype.failure = Query.prototype.fail = Query.prototype.error = function(fct) {
this.on('failure', fct)
return this
}
return Query
})()
...@@ -12,7 +12,7 @@ module.exports = (function() { ...@@ -12,7 +12,7 @@ module.exports = (function() {
raw: false raw: false
}, options || {}) }, options || {})
} }
Utils.addEventEmitter(Query) Utils._.extend(Query.prototype, require("../query").prototype)
Query.prototype.run = function(sql) { Query.prototype.run = function(sql) {
var self = this var self = this
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!