@@ -16,6 +16,7 @@ type Cassandra interface {
16
16
ExecuteQuery (string , ... interface {}) error
17
17
ExecuteBatch (gocql.BatchType , []string , [][]interface {}) error
18
18
ExecuteUnloggedBatch ([]string , [][]interface {}) error
19
+ ScanQueryCtx (ctx context.Context , queryString string , queryParams []interface {}, outParams ... interface {}) error
19
20
ScanQuery (string , []interface {}, ... interface {}) error
20
21
ScanCASQuery (string , []interface {}, ... interface {}) (bool , error )
21
22
IterQuery (string , []interface {}, ... interface {}) func () (int , bool , error )
@@ -169,9 +170,9 @@ func (c *cassandra) ExecuteUnloggedBatch(queries []string, params [][]interface{
169
170
return c .ExecuteBatch (gocql .UnloggedBatch , queries , params )
170
171
}
171
172
172
- // ScanQuery executes a provided SELECT query at the configured read consistency level.
173
- func (c * cassandra ) ScanQuery ( queryString string , queryParams []interface {}, outParams ... interface {}) error {
174
- if err := c .Query (c .rcl , queryString , queryParams ... ).Scan (outParams ... ); err != nil {
173
+ // ScanQueryCtx executes a provided SELECT query at the configured read consistency level.
174
+ func (c * cassandra ) ScanQueryCtx ( ctx context. Context , queryString string , queryParams []interface {}, outParams ... interface {}) error {
175
+ if err := c .Query (c .rcl , queryString , queryParams ... ).WithContext ( ctx ). Scan (outParams ... ); err != nil {
175
176
if err == gocql .ErrNotFound {
176
177
return NotFound
177
178
}
@@ -180,6 +181,11 @@ func (c *cassandra) ScanQuery(queryString string, queryParams []interface{}, out
180
181
return nil
181
182
}
182
183
184
+ // ScanQuery executes a provided SELECT query at the configured read consistency level.
185
+ func (c * cassandra ) ScanQuery (queryString string , queryParams []interface {}, outParams ... interface {}) error {
186
+ return c .ScanQueryCtx (context .Background (), queryString , queryParams , outParams ... )
187
+ }
188
+
183
189
// ScanCASQuery executes a lightweight transaction (an UPDATE or INSERT statement containing an IF clause)
184
190
// at the configured write consistency level.
185
191
func (c * cassandra ) ScanCASQuery (queryString string , queryParams []interface {}, outParams ... interface {}) (bool , error ) {
0 commit comments