georgysavva / scany

Library for scanning data from a database into Go structs and more
MIT License
1.27k stars 67 forks source link

transaction support #18

Closed AubSs closed 3 years ago

AubSs commented 3 years ago

Hi! Thank you for your library ! Do you have any plan of supporting native pgx transaction ? (like sqlx)

georgysavva commented 3 years ago

Hi, thanks for your question. It's already supported. When you call pgxscan.Select() or pgxscan.Get() you pass something that implements pgxscan.Querier interface and from the docs for this interface:

Querier is something that pgxscan can query and get the pgx.Rows from. For example, it can be: pgxpool.Pool, pgx.Conn or pgx.Tx

So you can use all scany functions on transactions or database instances, it doesn't matter for this library.

Actually, I am going to spot more light on this in the pgxscan package documentation.

georgysavva commented 3 years ago

Here is the new docs for it: https://pkg.go.dev/github.com/georgysavva/scany@v0.2.6/pgxscan#hdr-Querying_rows

AubSs commented 3 years ago

You rock ! thank you