knex/lib/dialects/websql/transaction.js

29 lines
844 B
JavaScript
Raw Normal View History

2015-04-22 15:39:29 -04:00
'use strict';
var makeKnex = require('../../util/make-knex')
2015-04-22 15:39:29 -04:00
var Promise = require('../../promise')
var inherits = require('inherits')
var assign = require('lodash/object/assign');
function Transaction_WebSQL(client, container, config, outerTx) {
this._promise = Promise.try(function() {
container(makeKnex(client))
})
}
var promiseInterface = [
'then', 'bind', 'catch', 'finally', 'asCallback',
'spread', 'map', 'reduce', 'tap', 'thenReturn',
'return', 'yield', 'ensure', 'nodeify', 'exec'
]
// Creates a method which "coerces" to a promise, by calling a
// "then" method on the current `Target`
promiseInterface.forEach(function(method) {
Transaction_WebSQL.prototype[method] = function() {
return (this._promise = this._promise[method].apply(this._promise, arguments))
}
})
2015-04-22 15:39:29 -04:00
module.exports = Transaction_WebSQL