Your Question

I know that gorm supports standard sql package conversion in db level using db.DB() but I couldn't find how I can convert the existing gorm transaction to *sql.Tx.

I have a use case where some operations are done using gorm transaction and then, I need to pass the *sql.Tx to an other library to do some other job. If the job is successfully, then I can commit the transaction.

The document you expected this should be explained

I've read the doc, but I could't find the doc about this.

Expected answer

I should be able to get the *sql.Tx from the existing gorm transaction

Comment From: n0izn0iz

// If in a transaction, ConnPool can be type asserted as an *sql.Tx
sqlTx := tx.Statement.ConnPool.(*sql.Tx)

should probably be in the docs