You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sqlUnit is strongly connected with database/sql because of *sql.Tx.
However, sql.Tx could be placed in an interface with Begin, Commit and Rollback functions.
That gives the ability to change databases without changes the unit implementation.
hey @maranqz! appreciate the reach out and ideation here!
thanks for the examples - admittedly i'm still a little fuzzy on the use cases being presented here, given the sqlUnit is meant to be tied to the sql standard package. not only is there a dependency on *sql.Tx, but also the work.UnitDB option requires a *sql.DB instance, and the sqlUnit itself is responsible for managing *sql.DB and the transaction handling, where your example implementations above remove that as well (it's shifted to trm).
That gives the ability to change databases without changes the unit implementation.
It's my understanding that database/sql defines an interface that supports dozens of database implementations and even more drivers. For example, this resource lists out 50+ drivers that are compatible with database/sql.
Hello,
sqlUnit is strongly connected with database/sql because of *sql.Tx.
However, sql.Tx could be placed in an interface with Begin, Commit and Rollback functions.
That gives the ability to change databases without changes the unit implementation.
What do you think about the idea?
interface{} version
generic version
The text was updated successfully, but these errors were encountered: