cassandra

package
v0.0.0-...-7e296ea Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidEvent is returned by InsertEvent when there is an attempt to
	// insert an invalid model.Tracker into the database.
	ErrInvalidEvent = errors.New("cassandra: cannot insert invalid event into the database")
)

Functions

func ClearDataset

func ClearDataset(session *gocql.Session, table string) error

ClearDataset will truncate a given table, removing all items presented in it.

func CreateEventTable

func CreateEventTable(session *gocql.Session, keyspace, table string) error

CreateTable creates a table in the Cassandra cluster which the given session created a connection with.

func CreateSession

func CreateSession(config gocql.ClusterConfig) (*gocql.Session, error)

CreateSession wraps the gocql.NewSession function. It returns a *gocql.Session, which can be used to run queries in an existing Cassandra cluster.

func DropTable

func DropTable(session *gocql.Session, table string) error

DropTable will execute a DROP cql expression in a given table.

func InsertEvent

func InsertEvent(session *gocql.Session, table string, event model.Event) error

InsertEvent uses a given session to insert the data presented in a given event tracker into an also given table. If the event is not valid, returns an ErrInvalidEvent error.

Types

type Cluster

type Cluster struct {
	Hosts           string
	Keyspace        string
	ProtocolVersion int
	Timeout         int
}

Cluster defines the basic configurations for creation and management of Apache Cassandra databases clusters.

  • Hosts defines the addresses of Cassandra's cluster nodes
  • Keyspace defines the cluster keyspace (name, identification, alias...)
  • ProtocolVersion defines the version of Cassandra communication protocol

func (Cluster) Create

func (c Cluster) Create() gocql.ClusterConfig

CreateCluster wraps the gocql.NewCluster function. It returns a *gocql.ClusterConfig which can be used to create sessions to connect to existing Cassandra clusters.

Jump to

Keyboard shortcuts

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