From ac11d960323fb9ce2ef51ae771c0576d1c3e5d94 Mon Sep 17 00:00:00 2001 From: whybangbang <525484036@qq.com> Date: Wed, 3 Feb 2021 11:24:55 +0800 Subject: [PATCH] session add method IsInTx add session IsInTx --- session_tx.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/session_tx.go b/session_tx.go index 57791703..f50bbf1f 100644 --- a/session_tx.go +++ b/session_tx.go @@ -84,3 +84,8 @@ func (session *Session) Commit() error { } return nil } + +// if current session is in a transaction +func (session *Session) IsInTx() bool { + return !session.isAutoCommit +} \ No newline at end of file