gocql

package
v1.2.14 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package gocql is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterClient added in v0.21.0

func RegisterClient(c Client)

RegisterClient registers a client into this package, can only be called once

Types

type Batch

type Batch interface {
	Query(string, ...interface{})
	WithContext(context.Context) Batch
	WithTimestamp(int64) Batch
	Consistency(Consistency) Batch
}

Batch is the interface for batch operation.

type BatchType

type BatchType byte

BatchType is the type of the Batch operation

const (
	LoggedBatch BatchType = iota
	UnloggedBatch
	CounterBatch
)

Definition of all BatchTypes

type Client

type Client interface {
	CreateSession(ClusterConfig) (Session, error)

	nosqlplugin.ClientErrorChecker
	IsCassandraConsistencyError(error) bool
}

Client is an interface for all gocql libraries.

func GetRegisteredClient added in v0.23.1

func GetRegisteredClient() Client

GetRegisteredClient gets a gocql client based registered object

type ClusterConfig

type ClusterConfig struct {
	Hosts                 string
	Port                  int
	User                  string
	Password              string
	AllowedAuthenticators []string
	Keyspace              string
	Region                string
	Datacenter            string
	MaxConns              int
	TLS                   *config.TLS
	ProtoVersion          int
	Consistency           Consistency
	SerialConsistency     SerialConsistency
	Timeout               time.Duration
	ConnectTimeout        time.Duration
}

ClusterConfig is the config for cassandra connection

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

func ParseConsistency added in v1.2.10

func ParseConsistency(s string) (Consistency, error)

func (Consistency) MarshalText added in v1.2.10

func (c Consistency) MarshalText() (text []byte, err error)

func (Consistency) String added in v1.2.10

func (c Consistency) String() string

func (*Consistency) UnmarshalText added in v1.2.10

func (c *Consistency) UnmarshalText(text []byte) error

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 MockBatch

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

MockBatch is a mock of Batch interface.

func NewMockBatch

func NewMockBatch(ctrl *gomock.Controller) *MockBatch

NewMockBatch creates a new mock instance.

func (*MockBatch) Consistency added in v0.25.0

func (m *MockBatch) Consistency(arg0 Consistency) Batch

Consistency mocks base method.

func (*MockBatch) EXPECT

func (m *MockBatch) EXPECT() *MockBatchMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBatch) Query

func (m *MockBatch) Query(arg0 string, arg1 ...interface{})

Query mocks base method.

func (*MockBatch) WithContext

func (m *MockBatch) WithContext(arg0 context.Context) Batch

WithContext mocks base method.

func (*MockBatch) WithTimestamp

func (m *MockBatch) WithTimestamp(arg0 int64) Batch

WithTimestamp mocks base method.

type MockBatchMockRecorder

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

MockBatchMockRecorder is the mock recorder for MockBatch.

func (*MockBatchMockRecorder) Consistency added in v0.25.0

func (mr *MockBatchMockRecorder) Consistency(arg0 interface{}) *gomock.Call

Consistency indicates an expected call of Consistency.

func (*MockBatchMockRecorder) Query

func (mr *MockBatchMockRecorder) Query(arg0 interface{}, arg1 ...interface{}) *gomock.Call

Query indicates an expected call of Query.

func (*MockBatchMockRecorder) WithContext

func (mr *MockBatchMockRecorder) WithContext(arg0 interface{}) *gomock.Call

WithContext indicates an expected call of WithContext.

func (*MockBatchMockRecorder) WithTimestamp

func (mr *MockBatchMockRecorder) WithTimestamp(arg0 interface{}) *gomock.Call

WithTimestamp indicates an expected call of WithTimestamp.

type MockClient

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

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) CreateSession

func (m *MockClient) CreateSession(arg0 ClusterConfig) (Session, error)

CreateSession mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) IsCassandraConsistencyError added in v0.25.0

func (m *MockClient) IsCassandraConsistencyError(arg0 error) bool

IsCassandraConsistencyError mocks base method.

func (*MockClient) IsDBUnavailableError added in v0.25.0

func (m *MockClient) IsDBUnavailableError(arg0 error) bool

IsDBUnavailableError mocks base method.

func (*MockClient) IsNotFoundError

func (m *MockClient) IsNotFoundError(arg0 error) bool

IsNotFoundError mocks base method.

func (*MockClient) IsThrottlingError

func (m *MockClient) IsThrottlingError(arg0 error) bool

IsThrottlingError mocks base method.

func (*MockClient) IsTimeoutError

func (m *MockClient) IsTimeoutError(arg0 error) bool

IsTimeoutError mocks base method.

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) CreateSession

func (mr *MockClientMockRecorder) CreateSession(arg0 interface{}) *gomock.Call

CreateSession indicates an expected call of CreateSession.

func (*MockClientMockRecorder) IsCassandraConsistencyError added in v0.25.0

func (mr *MockClientMockRecorder) IsCassandraConsistencyError(arg0 interface{}) *gomock.Call

IsCassandraConsistencyError indicates an expected call of IsCassandraConsistencyError.

func (*MockClientMockRecorder) IsDBUnavailableError added in v0.25.0

func (mr *MockClientMockRecorder) IsDBUnavailableError(arg0 interface{}) *gomock.Call

IsDBUnavailableError indicates an expected call of IsDBUnavailableError.

func (*MockClientMockRecorder) IsNotFoundError

func (mr *MockClientMockRecorder) IsNotFoundError(arg0 interface{}) *gomock.Call

IsNotFoundError indicates an expected call of IsNotFoundError.

func (*MockClientMockRecorder) IsThrottlingError

func (mr *MockClientMockRecorder) IsThrottlingError(arg0 interface{}) *gomock.Call

IsThrottlingError indicates an expected call of IsThrottlingError.

func (*MockClientMockRecorder) IsTimeoutError

func (mr *MockClientMockRecorder) IsTimeoutError(arg0 interface{}) *gomock.Call

IsTimeoutError indicates an expected call of IsTimeoutError.

type MockIter

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

MockIter is a mock of Iter interface.

func NewMockIter

func NewMockIter(ctrl *gomock.Controller) *MockIter

NewMockIter creates a new mock instance.

func (*MockIter) Close

func (m *MockIter) Close() error

Close mocks base method.

func (*MockIter) EXPECT

func (m *MockIter) EXPECT() *MockIterMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIter) MapScan

func (m *MockIter) MapScan(arg0 map[string]interface{}) bool

MapScan mocks base method.

func (*MockIter) PageState

func (m *MockIter) PageState() []byte

PageState mocks base method.

func (*MockIter) Scan

func (m *MockIter) Scan(arg0 ...interface{}) bool

Scan mocks base method.

type MockIterMockRecorder

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

MockIterMockRecorder is the mock recorder for MockIter.

func (*MockIterMockRecorder) Close

func (mr *MockIterMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockIterMockRecorder) MapScan

func (mr *MockIterMockRecorder) MapScan(arg0 interface{}) *gomock.Call

MapScan indicates an expected call of MapScan.

func (*MockIterMockRecorder) PageState

func (mr *MockIterMockRecorder) PageState() *gomock.Call

PageState indicates an expected call of PageState.

func (*MockIterMockRecorder) Scan

func (mr *MockIterMockRecorder) Scan(arg0 ...interface{}) *gomock.Call

Scan indicates an expected call of Scan.

type MockQuery

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

MockQuery is a mock of Query interface.

func NewMockQuery

func NewMockQuery(ctrl *gomock.Controller) *MockQuery

NewMockQuery creates a new mock instance.

func (*MockQuery) Bind

func (m *MockQuery) Bind(arg0 ...interface{}) Query

Bind mocks base method.

func (*MockQuery) Consistency

func (m *MockQuery) Consistency(arg0 Consistency) Query

Consistency mocks base method.

func (*MockQuery) EXPECT

func (m *MockQuery) EXPECT() *MockQueryMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockQuery) Exec

func (m *MockQuery) Exec() error

Exec mocks base method.

func (*MockQuery) Iter

func (m *MockQuery) Iter() Iter

Iter mocks base method.

func (*MockQuery) MapScan

func (m *MockQuery) MapScan(arg0 map[string]interface{}) error

MapScan mocks base method.

func (*MockQuery) MapScanCAS

func (m *MockQuery) MapScanCAS(arg0 map[string]interface{}) (bool, error)

MapScanCAS mocks base method.

func (*MockQuery) PageSize

func (m *MockQuery) PageSize(arg0 int) Query

PageSize mocks base method.

func (*MockQuery) PageState

func (m *MockQuery) PageState(arg0 []byte) Query

PageState mocks base method.

func (*MockQuery) Scan

func (m *MockQuery) Scan(arg0 ...interface{}) error

Scan mocks base method.

func (*MockQuery) ScanCAS

func (m *MockQuery) ScanCAS(arg0 ...interface{}) (bool, error)

ScanCAS mocks base method.

func (*MockQuery) WithContext

func (m *MockQuery) WithContext(arg0 context.Context) Query

WithContext mocks base method.

func (*MockQuery) WithTimestamp

func (m *MockQuery) WithTimestamp(arg0 int64) Query

WithTimestamp mocks base method.

type MockQueryMockRecorder

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

MockQueryMockRecorder is the mock recorder for MockQuery.

func (*MockQueryMockRecorder) Bind

func (mr *MockQueryMockRecorder) Bind(arg0 ...interface{}) *gomock.Call

Bind indicates an expected call of Bind.

func (*MockQueryMockRecorder) Consistency

func (mr *MockQueryMockRecorder) Consistency(arg0 interface{}) *gomock.Call

Consistency indicates an expected call of Consistency.

func (*MockQueryMockRecorder) Exec

func (mr *MockQueryMockRecorder) Exec() *gomock.Call

Exec indicates an expected call of Exec.

func (*MockQueryMockRecorder) Iter

func (mr *MockQueryMockRecorder) Iter() *gomock.Call

Iter indicates an expected call of Iter.

func (*MockQueryMockRecorder) MapScan

func (mr *MockQueryMockRecorder) MapScan(arg0 interface{}) *gomock.Call

MapScan indicates an expected call of MapScan.

func (*MockQueryMockRecorder) MapScanCAS

func (mr *MockQueryMockRecorder) MapScanCAS(arg0 interface{}) *gomock.Call

MapScanCAS indicates an expected call of MapScanCAS.

func (*MockQueryMockRecorder) PageSize

func (mr *MockQueryMockRecorder) PageSize(arg0 interface{}) *gomock.Call

PageSize indicates an expected call of PageSize.

func (*MockQueryMockRecorder) PageState

func (mr *MockQueryMockRecorder) PageState(arg0 interface{}) *gomock.Call

PageState indicates an expected call of PageState.

func (*MockQueryMockRecorder) Scan

func (mr *MockQueryMockRecorder) Scan(arg0 ...interface{}) *gomock.Call

Scan indicates an expected call of Scan.

func (*MockQueryMockRecorder) ScanCAS

func (mr *MockQueryMockRecorder) ScanCAS(arg0 ...interface{}) *gomock.Call

ScanCAS indicates an expected call of ScanCAS.

func (*MockQueryMockRecorder) WithContext

func (mr *MockQueryMockRecorder) WithContext(arg0 interface{}) *gomock.Call

WithContext indicates an expected call of WithContext.

func (*MockQueryMockRecorder) WithTimestamp

func (mr *MockQueryMockRecorder) WithTimestamp(arg0 interface{}) *gomock.Call

WithTimestamp indicates an expected call of WithTimestamp.

type MockSession

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

MockSession is a mock of Session interface.

func NewMockSession

func NewMockSession(ctrl *gomock.Controller) *MockSession

NewMockSession creates a new mock instance.

func (*MockSession) Close

func (m *MockSession) Close()

Close mocks base method.

func (*MockSession) EXPECT

func (m *MockSession) EXPECT() *MockSessionMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSession) ExecuteBatch

func (m *MockSession) ExecuteBatch(arg0 Batch) error

ExecuteBatch mocks base method.

func (*MockSession) MapExecuteBatchCAS

func (m *MockSession) MapExecuteBatchCAS(arg0 Batch, arg1 map[string]interface{}) (bool, Iter, error)

MapExecuteBatchCAS mocks base method.

func (*MockSession) NewBatch

func (m *MockSession) NewBatch(arg0 BatchType) Batch

NewBatch mocks base method.

func (*MockSession) Query

func (m *MockSession) Query(arg0 string, arg1 ...interface{}) Query

Query mocks base method.

type MockSessionMockRecorder

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

MockSessionMockRecorder is the mock recorder for MockSession.

func (*MockSessionMockRecorder) Close

func (mr *MockSessionMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockSessionMockRecorder) ExecuteBatch

func (mr *MockSessionMockRecorder) ExecuteBatch(arg0 interface{}) *gomock.Call

ExecuteBatch indicates an expected call of ExecuteBatch.

func (*MockSessionMockRecorder) MapExecuteBatchCAS

func (mr *MockSessionMockRecorder) MapExecuteBatchCAS(arg0, arg1 interface{}) *gomock.Call

MapExecuteBatchCAS indicates an expected call of MapExecuteBatchCAS.

func (*MockSessionMockRecorder) NewBatch

func (mr *MockSessionMockRecorder) NewBatch(arg0 interface{}) *gomock.Call

NewBatch indicates an expected call of NewBatch.

func (*MockSessionMockRecorder) Query

func (mr *MockSessionMockRecorder) Query(arg0 interface{}, arg1 ...interface{}) *gomock.Call

Query indicates an expected call of Query.

type MockUUID

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

MockUUID is a mock of UUID interface.

func NewMockUUID

func NewMockUUID(ctrl *gomock.Controller) *MockUUID

NewMockUUID creates a new mock instance.

func (*MockUUID) EXPECT

func (m *MockUUID) EXPECT() *MockUUIDMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUUID) String

func (m *MockUUID) String() string

String mocks base method.

type MockUUIDMockRecorder

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

MockUUIDMockRecorder is the mock recorder for MockUUID.

func (*MockUUIDMockRecorder) String

func (mr *MockUUIDMockRecorder) String() *gomock.Call

String indicates an expected call of String.

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

func ParseSerialConsistency added in v1.2.10

func ParseSerialConsistency(s string) (SerialConsistency, error)

func (SerialConsistency) MarshalText added in v1.2.10

func (s SerialConsistency) MarshalText() (text []byte, err error)

func (SerialConsistency) String added in v1.2.10

func (s SerialConsistency) String() string

func (*SerialConsistency) UnmarshalText added in v1.2.10

func (s *SerialConsistency) UnmarshalText(text []byte) error

type Session

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

Session is the interface for interacting with the database.

func NewSession added in v0.21.0

func NewSession(
	config ClusterConfig,
) (Session, error)

type UUID

type UUID interface {
	String() string
}

UUID represents a universally unique identifier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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