feat: add NewSessionFromTx to interact with other orm (#1202)

Co-authored-by: yedongfu <dongfuye@163.com>
master
yedf2 3 years ago committed by GitHub
parent 3c894a3fb7
commit 6aba5f74fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,12 @@ type (
}
)
// NewSessionFromTx returns a Session with the given sql.Tx.
// Use it with caution, it's provided for other ORM to interact with.
func NewSessionFromTx(tx *sql.Tx) Session {
return txSession{Tx: tx}
}
func (t txSession) Exec(q string, args ...interface{}) (sql.Result, error) {
return exec(t.Tx, q, args...)
}

Loading…
Cancel
Save