-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
1 lines (1 loc) · 2.19 KB
/
index.js
1
'use strict';var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value" in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();function _classCallCheck(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}var noop=function a(){},StatementBindings=function(){function a(b,c){_classCallCheck(this,a);this._stmt=b;this.TaskImpl=c}_createClass(a,[{key:"run",value:function b(a){var c=this,d=this;return this.TaskImpl(function(b,e){c._stmt.run(a,function(a){return a?b(a):e(d)})})}},{key:"finalize",value:function a(){var b=this;return this.TaskImpl(function(a,c){b._stmt.finalize(function(b){return b?a(b):c()})})}}]);return a}(),DatabaseBindings=function(){function a(b,c){_classCallCheck(this,a);this.TaskImpl=c;this._db=b}_createClass(a,[{key:"wrapStmt",value:function b(a){return new StatementBindings(a,this.TaskImpl)}},{key:"close",value:function a(){var b=this;return this.TaskImpl(function(a,c){b._db.close(function(b){return b?a(b):c()})})}},{key:"all",value:function c(a,b){var d=this;return this.TaskImpl(function(c,e){d._db.all(a,b,function(a,b){return a?c(a):e(b)})})}},{key:"prepare",value:function c(a,b){var d=this,e=this;return this.TaskImpl(function(c,f){d._db.prepare(a,b,function(a){return a?c(a):f(e.wrapStmt(this))})})}},{key:"run",value:function b(a){var c=this,d=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return this.TaskImpl(function(b,e){c._db.run(a,d,function(a){return a?b(a):e(this)})})}},{key:"get",value:function b(a){var c=this,d=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return this.TaskImpl(function(b,e){c._db.get(a,d,function(a,c){return a?b(a):e(c)})})}},{key:"each",value:function c(a,b){var d=this,e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:noop;return this.TaskImpl(function(c,f){d._db.each(a,b,e,function(a,b){return a?c(a):f(b)})})}},{key:"exec",value:function b(a){var c=this;return this.TaskImpl(function(b,d){c._db.exec(a,function(a){return a?b(a):d()})})}}]);return a}();function createBindings(a,b){return new DatabaseBindings(b,a)}module.exports=createBindings