gocql

package
v1.26.2-125.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureCassandraCluster added in v1.20.1

func ConfigureCassandraCluster(cfg config.Cassandra, cluster *gocql.ClusterConfig) error

Modifies the input cluster config in place.

func ConvertError

func ConvertError(
	operation string,
	err error,
) error

func IsNotFoundError

func IsNotFoundError(err error) bool

func NewCassandraCluster

func NewCassandraCluster(
	cfg config.Cassandra,
	resolver resolver.ServiceResolver,
) (*gocql.ClusterConfig, error)

func NewSession

func NewSession(
	newClusterConfigFunc func() (*gocql.ClusterConfig, error),
	logger log.Logger,
	metricsHandler metrics.Handler,
) (*session, error)

func UUIDToString

func UUIDToString(
	item interface{},
) string

func UUIDsToStringSlice added in v1.14.0

func UUIDsToStringSlice(
	item interface{},
) []string

Types

type Batch

type Batch struct {
	// contains filtered or unexported fields
}

func (*Batch) Query

func (b *Batch) Query(stmt string, args ...interface{})

func (*Batch) WithContext

func (b *Batch) WithContext(ctx context.Context) *Batch

func (*Batch) WithTimestamp

func (b *Batch) WithTimestamp(timestamp int64) *Batch

type BatchType

type BatchType byte

BatchType is the type of the Batch operation

const (
	LoggedBatch BatchType = iota
	UnloggedBatch
	CounterBatch
)

Definition of all BatchTypes

type Consistency

type Consistency uint16

Consistency is the consistency level used by a Query

const (
	Any Consistency = iota
	One
	Two
	Three
	Quorum
	All
	LocalQuorum
	EachQuorum
	LocalOne
)

Definition of all Consistency levels

type Iter

type Iter interface {
	Scan(...interface{}) bool
	MapScan(map[string]interface{}) bool
	PageState() []byte
	Close() error
}

Iter is the interface for executing and iterating over all resulting rows.

type Query

type Query interface {
	Exec() error
	Scan(...interface{}) error
	ScanCAS(...interface{}) (bool, error)
	MapScan(map[string]interface{}) error
	MapScanCAS(map[string]interface{}) (bool, error)
	Iter() Iter
	PageSize(int) Query
	PageState([]byte) Query
	WithContext(context.Context) Query
	WithTimestamp(int64) Query
	Consistency(Consistency) Query
	Bind(...interface{}) Query
}

Query is the interface for query object.

type SerialConsistency

type SerialConsistency uint16

SerialConsistency is the serial consistency level used by a Query

const (
	Serial SerialConsistency = iota
	LocalSerial
)

Definition of all SerialConsistency levels

type Session

type Session interface {
	Query(string, ...interface{}) Query
	NewBatch(BatchType) *Batch
	ExecuteBatch(*Batch) error
	MapExecuteBatchCAS(*Batch, map[string]interface{}) (bool, Iter, error)
	AwaitSchemaAgreement(ctx context.Context) error
	Close()
}

Session is the interface for interacting with the database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL