2
0

Split batch command and result

This commit is contained in:
Jack Christensen
2019-04-24 16:39:06 -05:00
parent 7b4e145e7c
commit aed6b822d9
7 changed files with 161 additions and 186 deletions
+7 -3
View File
@@ -185,9 +185,13 @@ func (tx *Tx) CopyFrom(ctx context.Context, tableName Identifier, columnNames []
return tx.conn.CopyFrom(ctx, tableName, columnNames, rowSrc)
}
// BeginBatch returns a *Batch query for the tx's connection.
func (tx *Tx) BeginBatch() *Batch {
return &Batch{conn: tx.conn}
// SendBatch delegates to the underlying *Conn
func (tx *Tx) SendBatch(ctx context.Context, b *Batch) *BatchResults {
if tx.status != TxStatusInProgress {
return &BatchResults{err: ErrTxClosed}
}
return tx.conn.SendBatch(ctx, b)
}
// Status returns the status of the transaction from the set of