Upgrade gocql to 1.15.3 (#343)

gocql 1.15.3 brings new APIs for `gocql.Batch` and `gocql.Query`:
- `SetRequestTimeout`
- `GetRequestTimeout`

So, this change adds relative APIs to the `gocqlx.Batch` and `gocqlx.Queryx`.
This commit is contained in:
Dmitry Kropachev
2025-09-08 06:25:00 -04:00
committed by GitHub
parent 9f74b689a9
commit 25cee51cac
7 changed files with 36 additions and 8 deletions

View File

@@ -3,6 +3,8 @@ package gocqlx
import (
"context"
"fmt"
"time"
"github.com/gocql/gocql"
)
@@ -34,6 +36,19 @@ func (s *Session) ContextBatch(ctx context.Context, bt gocql.BatchType) *Batch {
}
}
// GetRequestTimeout returns time driver waits for single server response
// This timeout is applied to preparing statement request and for query execution requests
func (b *Batch) GetRequestTimeout() time.Duration {
return b.Batch.GetRequestTimeout()
}
// SetRequestTimeout sets time driver waits for server to respond
// This timeout is applied to preparing statement request and for query execution requests
func (b *Batch) SetRequestTimeout(timeout time.Duration) *Batch {
b.Batch.SetRequestTimeout(timeout)
return b
}
// SetHostID allows to define the host the query should be executed against. If the
// host was filtered or otherwise unavailable, then the query will error. If an empty
// string is sent, the default behavior, using the configured HostSelectionPolicy will