jackc / pgx

PostgreSQL driver and toolkit for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to call pgx.Tx CopyFrom with sql.Tx

firstone opened this issue · comments

pgx.Tx supports CopyFrom but there seems to be no way to use it from sql driver. Raw call will only produce pgx.Conn object but I don't see a way to call CopyFrom via sql.Tx

I don't know of any way to get a reference to a pgx object directly from a *sql.Tx. You could probably call Raw and BeginTx on the same *sql.Conn to start a transaction and be able to get the underlying *pgx.Conn -- but obviously that's a bit messy and error prone.