Added Context variants of Query functions
This commit is contained in:
committed by
Michal Jan Matczuk
parent
8af6506cde
commit
4ea6f42a51
@@ -6,6 +6,7 @@ package qb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -71,6 +72,11 @@ func (b *BatchBuilder) Query(session gocqlx.Session) *gocqlx.Queryx {
|
||||
return session.Query(b.ToCql())
|
||||
}
|
||||
|
||||
// QueryContext returns query wrapped with context built on top of current BatchBuilder state.
|
||||
func (b *BatchBuilder) QueryContext(ctx context.Context, session gocqlx.Session) *gocqlx.Queryx {
|
||||
return b.Query(session).WithContext(ctx)
|
||||
}
|
||||
|
||||
// Add builds the builder and adds the statement to the batch.
|
||||
func (b *BatchBuilder) Add(builder Builder) *BatchBuilder {
|
||||
return b.AddStmt(builder.ToCql())
|
||||
|
||||
Reference in New Issue
Block a user