cassandra

package
v0.0.0-...-c0686e8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateStoreSession

func CreateStoreSession(
	storeConfig *CassandraConn, keySpace string) (*gocql.Session, error)

CreateStoreSession is to create clusters and connections

func DeleteStmt

func DeleteStmt(opts ...OptFunc) (string, error)

DeleteStmt creates delete statement

func InsertStmt

func InsertStmt(opts ...OptFunc) (string, error)

InsertStmt creates insert statement

func NewCassandraConnector

func NewCassandraConnector(
	config *Config,
	scope tally.Scope,
) (orm.Connector, error)

NewCassandraConnector initializes a Cassandra Connector

func SelectStmt

func SelectStmt(opts ...OptFunc) (string, error)

SelectStmt creates select statement

func UpdateStmt

func UpdateStmt(opts ...OptFunc) (string, error)

UpdateStmt creates update statement

Types

type CassandraConn

type CassandraConn struct {
	ContactPoints      []string      `yaml:"contactPoints"`
	Port               int           `yaml:"port"`
	Username           string        `yaml:"username"`
	Password           string        `yaml:"password"`
	Consistency        string        `yaml:"consistency"`
	SerialConsistency  string        `yaml:"serialConsistency"`
	ConnectionsPerHost int           `yaml:"connectionsPerHost"`
	Timeout            time.Duration `yaml:"timeout"`
	SocketKeepalive    time.Duration `yaml:"socketKeepalive"`
	ProtoVersion       int           `yaml:"protoVersion"`
	TTL                time.Duration `yaml:"ttl"`
	LocalDCOnly        bool          `yaml:"localDCOnly"` // deprecated
	DataCenter         string        `yaml:"dataCenter"`  // data center filter
	PageSize           int           `yaml:"pageSize"`
	RetryCount         int           `yaml:"retryCount"`
	HostPolicy         string        `yaml:"hostPolicy"`
	TimeoutLimit       int           `yaml:"timeoutLimit"`  // number of timeouts allowed
	CQLVersion         string        `yaml:"cqlVersion"`    // set only on C* 3.x
	MaxGoRoutines      int           `yaml:"maxGoroutines"` // a capacity limit
}

CassandraConn describes the properties to manage a Cassandra connection.

type Config

type Config struct {
	CassandraConn *CassandraConn `yaml:"connection"`
	StoreName     string         `yaml:"store_name"`
	Migrations    string         `yaml:"migrations"`
}

Config is the config for cassandra Store

type OptFunc

type OptFunc func(Option)

OptFunc is the interface to set option

func Columns

func Columns(v []string) OptFunc

Columns sets the `columns` clause to the cql statement

func Conditions

func Conditions(v interface{}) OptFunc

Conditions set the `where` clause to the cql statement

func IfNotExist

func IfNotExist(v interface{}) OptFunc

IfNotExist sets the `if not exist` clause to the cql statement

func Limit

func Limit(v interface{}) OptFunc

Limit sets the `limit` to the cql statement.

func Table

func Table(v string) OptFunc

Table sets the `table` to the cql statement

func Updates

func Updates(v interface{}) OptFunc

Updates set the `SET` clause to the cql statement

func Values

func Values(v interface{}) OptFunc

Values sets the `values` clause to the cql statement

type Option

type Option map[string]interface{}

Option to compose a cql statement

Jump to

Keyboard shortcuts

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