Re: [go-nuts] [Proposal] database/sql: add interface that unite DB and Tx

2020-01-17 Thread 'Eric Johnson' via golang-nuts
Indeed. The strength of Go's interfaces is precisely that a library provider does not need to create interfaces, unless they are critical to the implementation of the library. You should create these types of interfaces when you need them. There's a subtle versioning problem here. If Go adds a

Re: [go-nuts] [Proposal] database/sql: add interface that unite DB and Tx

2020-01-16 Thread Marcin Romaszewicz
I have that exact interface in all of my DB code, and I never use sql.Tx or sql.DB directly. You don't need Go's libraries to adopt this at all, just use your own. On Wed, Jan 15, 2020 at 11:20 PM Mhd Shulhan wrote: > ## Problem > > At some point we have a function that receive an instance of da

[go-nuts] [Proposal] database/sql: add interface that unite DB and Tx

2020-01-15 Thread Mhd Shulhan
## Problem At some point we have a function that receive an instance of database connection to query rows in specific table. Let's say that function F() accept DB that query table T. If function F() called with DB instance, it will query only rows that has been committed into database. IF fun