2
0

Add CopyTo to support PostgreSQL copy protocol

fixes #102
This commit is contained in:
Jack Christensen
2016-08-10 16:27:44 -05:00
parent bb73d84279
commit 5f7d01778e
9 changed files with 991 additions and 0 deletions
+9
View File
@@ -158,6 +158,15 @@ func (tx *Tx) QueryRow(sql string, args ...interface{}) *Row {
return (*Row)(rows)
}
// CopyTo delegates to the underlying *Conn
func (tx *Tx) CopyTo(tableName string, columnNames []string, rowSrc CopyToSource) (int, error) {
if tx.status != TxStatusInProgress {
return 0, ErrTxClosed
}
return tx.conn.CopyTo(tableName, columnNames, rowSrc)
}
// Conn returns the *Conn this transaction is using.
func (tx *Tx) Conn() *Conn {
return tx.conn