From b2945197878342caabecce43da9b8a49376785d5 Mon Sep 17 00:00:00 2001 From: Janny Date: Mon, 20 Jan 2020 15:33:38 -0500 Subject: [PATCH] feat: add isactive check for transaction (#164) --- lib/transaction.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/transaction.js b/lib/transaction.js index 7548a92..b599354 100644 --- a/lib/transaction.js +++ b/lib/transaction.js @@ -134,3 +134,10 @@ Transaction.begin = function(connector, options, cb) { }); if (cb.promise) return cb.promise; }; + +/** + * Check whether a transaction has an active connection. + */ +Transaction.prototype.isActive = function() { + return !!this.connection; +};