mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
## What changed? Integrate Go 1.26's new `go fix` into workflow. NOTE that the changes caused our linter to fire; a [separate commit](https://github.com/temporalio/temporal/pull/9337/commits/1b23f787aef370098b35829c4d17dcc06230b4c1) addresses those. ## Why? Ensure Go code is standardized/modernized. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [x] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
63 lines
1.7 KiB
Go
63 lines
1.7 KiB
Go
package gocql
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gocql/gocql"
|
|
)
|
|
|
|
// Note: this file defines the minimal interface that is needed by Temporal's cassandra
|
|
// persistence implementation and should be implemented for all gocql libraries if
|
|
// they need to be used.
|
|
// Please add more methods to the interface if needed by the cassandra implementation.
|
|
|
|
type (
|
|
// Session is the interface for interacting with the database.
|
|
Session interface {
|
|
Query(string, ...any) Query
|
|
NewBatch(BatchType) *Batch
|
|
ExecuteBatch(*Batch) error
|
|
MapExecuteBatchCAS(*Batch, map[string]any) (bool, Iter, error)
|
|
AwaitSchemaAgreement(ctx context.Context) error
|
|
Close()
|
|
}
|
|
|
|
// Query is the interface for query object.
|
|
Query interface {
|
|
Exec() error
|
|
Scan(...any) error
|
|
ScanCAS(...any) (bool, error)
|
|
MapScan(map[string]any) error
|
|
MapScanCAS(map[string]any) (bool, error)
|
|
Iter() Iter
|
|
PageSize(int) Query
|
|
PageState([]byte) Query
|
|
WithContext(context.Context) Query
|
|
WithTimestamp(int64) Query
|
|
Consistency(Consistency) Query
|
|
Bind(...any) Query
|
|
Idempotent(bool) Query
|
|
SetSpeculativeExecutionPolicy(SpeculativeExecutionPolicy) Query
|
|
}
|
|
|
|
// Iter is the interface for executing and iterating over all resulting rows.
|
|
Iter interface {
|
|
Scan(...any) bool
|
|
MapScan(map[string]any) bool
|
|
PageState() []byte
|
|
Close() error
|
|
}
|
|
|
|
// BatchType is the type of the Batch operation
|
|
BatchType byte
|
|
|
|
// Consistency is the consistency level used by a Query
|
|
Consistency uint16
|
|
|
|
// SerialConsistency is the serial consistency level used by a Query
|
|
SerialConsistency uint16
|
|
|
|
// SpeculativeExecutionPolicy is a gocql SpeculativeExecutionPolicy
|
|
SpeculativeExecutionPolicy gocql.SpeculativeExecutionPolicy
|
|
)
|