-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why not use sql.DB instead of adapter.Tx #148
Comments
Adapter generalises db interface because only |
That makes sense I endedup writing an adapter for sql.DB so I could use sql.DB with generic functions. myConnPool := NewConnPool(dbSQL)
tx, err := myConnPool.Begin(c)
if err != nil {
log.Fatal(err)
}
defer tx.Rollback(c)
... use tx in my function However _ "github.com/jackc/pgx/v5/stdlib"
db, err := sql.Open("pgx", "postgres://postgres:@localhost:5432/example_db")
if err != nil {
log.Fatal(err)
} |
Originally library worked only with |
I wonder whether we could have an adapter for |
I could see the |
@owenthereal probably you're looking for https://github.com/vgarvardt/gue#libpq |
@vgarvardt Ah missed that. Thanks! I was confused by the package name. I would suggest rename the package to stdlib or something |
@owenthereal sdlib sql is an interface and several drivers implement it - |
Using this adapter.Tx makes it hard to write portable functions it would be best to just use sql.DB instead of adapter.Tx
The text was updated successfully, but these errors were encountered: