Add SendBatch to pool
This commit is contained in:
@@ -683,7 +683,7 @@ func (c *Conn) QueryRow(ctx context.Context, sql string, args ...interface{}) Ro
|
||||
|
||||
// SendBatch sends all queued queries to the server at once. All queries are run in an implicit transaction unless
|
||||
// explicit transaction control statements are executed.
|
||||
func (c *Conn) SendBatch(ctx context.Context, b *Batch) *BatchResults {
|
||||
func (c *Conn) SendBatch(ctx context.Context, b *Batch) BatchResults {
|
||||
batch := &pgconn.Batch{}
|
||||
|
||||
for _, bi := range b.items {
|
||||
@@ -698,7 +698,7 @@ func (c *Conn) SendBatch(ctx context.Context, b *Batch) *BatchResults {
|
||||
|
||||
args, err := convertDriverValuers(bi.arguments)
|
||||
if err != nil {
|
||||
return &BatchResults{err: err}
|
||||
return &batchResults{err: err}
|
||||
}
|
||||
|
||||
paramFormats := make([]int16, len(args))
|
||||
@@ -707,7 +707,7 @@ func (c *Conn) SendBatch(ctx context.Context, b *Batch) *BatchResults {
|
||||
paramFormats[i] = chooseParameterFormatCode(c.ConnInfo, parameterOIDs[i], args[i])
|
||||
paramValues[i], err = newencodePreparedStatementArgument(c.ConnInfo, parameterOIDs[i], args[i])
|
||||
if err != nil {
|
||||
return &BatchResults{err: err}
|
||||
return &batchResults{err: err}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -739,7 +739,7 @@ func (c *Conn) SendBatch(ctx context.Context, b *Batch) *BatchResults {
|
||||
|
||||
mrr := c.pgConn.ExecBatch(ctx, batch)
|
||||
|
||||
return &BatchResults{
|
||||
return &batchResults{
|
||||
conn: c,
|
||||
mrr: mrr,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user