wrapper

package
v0.0.0-...-ce8de81 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(clusterHostName, systemKeyspace, appKeyspace string, connectionTimeout time.Duration)

Initialize waits for a Cassandra session, initializes Cassandra keyspace and creates tables if required. NOTE: Needs to be called only once on the app startup, won't fail if it is called multiple times but is not necessary.

Params:

clusterHostName: Cassandra cluster host
systemKeyspace: System keyspace
appKeyspace: Application keyspace
connectionTimeout: timeout to get the connection

Types

type Holder

type Holder interface {
	GetSession() SessionInterface
	CloseSession()
}

Holder allows to store a close sessions

type Initializer

type Initializer interface {
	NewSession() (Holder, error)
}

Initializer is a common interface for functionality to start a new session

func New

func New(clusterHostName, keyspace string) Initializer

New return a cassandra session Initializer

type IterInterface

type IterInterface interface {
	Scan(dest ...interface{}) bool
	WillSwitchPage() bool
	PageState() []byte
	Close() error
	ScanAndClose(handle func() bool, dest ...interface{}) error
}

type QueryInterface

type QueryInterface interface {
	Exec() error
	Scan(dest ...interface{}) error
	Iter() IterInterface
	PageState(state []byte) QueryInterface
	PageSize(n int) QueryInterface
}

type SessionInterface

type SessionInterface interface {
	Query(stmt string, values ...interface{}) QueryInterface
	Close()
}

SessionInterface is an interface to wrap gocql methods used in Motiv

Jump to

Keyboard shortcuts

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