cassandra

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package cassandra is a generated GoMock package.

Package cassandra is a generated GoMock package.

Package cassandra is a generated GoMock package.

Index

Constants

View Source
const (
	LoggedBatch = iota
	UnloggedBatch
	CounterBatch
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(conf Config) *Client

New initializes Cassandra driver with the provided configuration. The Connect method must be called to establish a connection to Cassandra. Usage:

client := New(config)
client.UseLogger(loggerInstance)
client.UseMetrics(metricsInstance)
client.Connect()

func (*Client) BatchQuery

func (c *Client) BatchQuery(name, stmt string, values ...any) error

func (*Client) Connect

func (c *Client) Connect()

Connect establishes a connection to Cassandra and registers metrics using the provided configuration when the client was Created.

func (*Client) Exec

func (c *Client) Exec(stmt string, values ...any) error

func (*Client) ExecCAS

func (c *Client) ExecCAS(dest any, stmt string, values ...any) (bool, error)

func (*Client) ExecuteBatch

func (c *Client) ExecuteBatch(name string) error

func (*Client) ExecuteBatchCAS

func (c *Client) ExecuteBatchCAS(name string, dest ...any) (bool, error)

func (*Client) HealthCheck

func (c *Client) HealthCheck(context.Context) (any, error)

HealthCheck checks the health of the Cassandra.

func (*Client) NewBatch

func (c *Client) NewBatch(name string, batchType int) error

func (*Client) Query

func (c *Client) Query(dest any, stmt string, values ...any) error

func (*Client) UseLogger

func (c *Client) UseLogger(logger interface{})

UseLogger sets the logger for the Cassandra client which asserts the Logger interface.

func (*Client) UseMetrics

func (c *Client) UseMetrics(metrics interface{})

UseMetrics sets the metrics for the Cassandra client which asserts the Metrics interface.

type Config

type Config struct {
	Hosts    string
	Keyspace string
	Port     int
	Username string
	Password string
}

type Health

type Health struct {
	Status  string         `json:"status,omitempty"`
	Details map[string]any `json:"details,omitempty"`
}

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(pattern string, args ...interface{})
	Log(args ...interface{})
	Logf(pattern string, args ...interface{})
	Error(args ...interface{})
	Errorf(patter string, args ...interface{})
}

type Metrics

type Metrics interface {
	NewHistogram(name, desc string, buckets ...float64)

	RecordHistogram(ctx context.Context, name string, value float64, labels ...string)
}

type MockLogger

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

MockLogger is a mock of Logger interface.

func NewMockLogger

func NewMockLogger(ctrl *gomock.Controller) *MockLogger

NewMockLogger creates a new mock instance.

func (*MockLogger) Debug

func (m *MockLogger) Debug(args ...any)

Debug mocks base method.

func (*MockLogger) Debugf

func (m *MockLogger) Debugf(pattern string, args ...any)

Debugf mocks base method.

func (*MockLogger) EXPECT

func (m *MockLogger) EXPECT() *MockLoggerMockRecorder

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

func (*MockLogger) Error

func (m *MockLogger) Error(args ...any)

Error mocks base method.

func (*MockLogger) Errorf

func (m *MockLogger) Errorf(patter string, args ...any)

Errorf mocks base method.

func (*MockLogger) Log

func (m *MockLogger) Log(args ...any)

Log mocks base method.

func (*MockLogger) Logf

func (m *MockLogger) Logf(pattern string, args ...any)

Logf mocks base method.

type MockLoggerMockRecorder

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

MockLoggerMockRecorder is the mock recorder for MockLogger.

func (*MockLoggerMockRecorder) Debug

func (mr *MockLoggerMockRecorder) Debug(args ...any) *gomock.Call

Debug indicates an expected call of Debug.

func (*MockLoggerMockRecorder) Debugf

func (mr *MockLoggerMockRecorder) Debugf(pattern any, args ...any) *gomock.Call

Debugf indicates an expected call of Debugf.

func (*MockLoggerMockRecorder) Error

func (mr *MockLoggerMockRecorder) Error(args ...any) *gomock.Call

Error indicates an expected call of Error.

func (*MockLoggerMockRecorder) Errorf

func (mr *MockLoggerMockRecorder) Errorf(patter any, args ...any) *gomock.Call

Errorf indicates an expected call of Errorf.

func (*MockLoggerMockRecorder) Log

func (mr *MockLoggerMockRecorder) Log(args ...any) *gomock.Call

Log indicates an expected call of Log.

func (*MockLoggerMockRecorder) Logf

func (mr *MockLoggerMockRecorder) Logf(pattern any, args ...any) *gomock.Call

Logf indicates an expected call of Logf.

type MockMetrics

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

MockMetrics is a mock of Metrics interface.

func NewMockMetrics

func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics

NewMockMetrics creates a new mock instance.

func (*MockMetrics) EXPECT

func (m *MockMetrics) EXPECT() *MockMetricsMockRecorder

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

func (*MockMetrics) NewHistogram

func (m *MockMetrics) NewHistogram(name, desc string, buckets ...float64)

NewHistogram mocks base method.

func (*MockMetrics) RecordHistogram

func (m *MockMetrics) RecordHistogram(ctx context.Context, name string, value float64, labels ...string)

RecordHistogram mocks base method.

type MockMetricsMockRecorder

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

MockMetricsMockRecorder is the mock recorder for MockMetrics.

func (*MockMetricsMockRecorder) NewHistogram

func (mr *MockMetricsMockRecorder) NewHistogram(name, desc any, buckets ...any) *gomock.Call

NewHistogram indicates an expected call of NewHistogram.

func (*MockMetricsMockRecorder) RecordHistogram

func (mr *MockMetricsMockRecorder) RecordHistogram(ctx, name, value any, labels ...any) *gomock.Call

RecordHistogram indicates an expected call of RecordHistogram.

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) 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(stmt string, args ...any)

Query mocks base method.

type MockbatchMockRecorder

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

MockbatchMockRecorder is the mock recorder for Mockbatch.

func (*MockbatchMockRecorder) Query

func (mr *MockbatchMockRecorder) Query(stmt any, args ...any) *gomock.Call

Query indicates an expected call of Query.

type MockclusterConfig

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

MockclusterConfig is a mock of clusterConfig interface.

func NewMockclusterConfig

func NewMockclusterConfig(ctrl *gomock.Controller) *MockclusterConfig

NewMockclusterConfig creates a new mock instance.

func (*MockclusterConfig) EXPECT

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

type MockclusterConfigMockRecorder

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

MockclusterConfigMockRecorder is the mock recorder for MockclusterConfig.

type Mockiterator

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

Mockiterator is a mock of iterator interface.

func NewMockiterator

func NewMockiterator(ctrl *gomock.Controller) *Mockiterator

NewMockiterator creates a new mock instance.

func (*Mockiterator) EXPECT

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

type MockiteratorMockRecorder

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

MockiteratorMockRecorder is the mock recorder for Mockiterator.

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) EXPECT

func (m *Mockquery) EXPECT() *MockqueryMockRecorder

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

type MockqueryMockRecorder

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

MockqueryMockRecorder is the mock recorder for Mockquery.

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) EXPECT

func (m *Mocksession) EXPECT() *MocksessionMockRecorder

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

type MocksessionMockRecorder

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

MocksessionMockRecorder is the mock recorder for Mocksession.

type QueryLog

type QueryLog struct {
	Query    string `json:"query"`
	Duration int64  `json:"duration"`
	Keyspace string `json:"keyspace,omitempty"`
}

func (*QueryLog) PrettyPrint

func (ql *QueryLog) PrettyPrint(writer io.Writer)

Jump to

Keyboard shortcuts

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