When one needs SQL, which is not supported by upper/db, one uses sess.Driver() directly.
Consider the following:
- I would like to use
upper/db for CRUD, because it is tedious to write by hand.
- I would also like to use "
sql-helper-library", a third-party library which provides me with functionality that I need.
- Operations performed by both of the libraries need to run in a transaction.
Now there is a problem.
Both of the two libraries should use one and the same transaction.
Since the sql-helper-library uses plain database/sql, it can use sql.Tx if given.
upper/db's type Tx does not expose the underlying sql.Tx, nor can it use an externally-started sql.Tx.
Either of those options would allow upper/db to inter-operate with other golang database libraries.
I deeply request this feature: to expose and set sql.Tx in upper/db's type Database