cassandra

package
v0.0.0-...-91b10f3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Query

type Query struct {
	RawQuery       bool
	Target         string
	Keyspace       string
	Table          string
	ColumnValue    string
	ColumnID       string
	ValueID        string
	AliasID        string
	ColumnTime     string
	TimeFrom       time.Time
	TimeTo         time.Time
	AllowFiltering bool
}

type Session

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

Session is a convenience wrapper for the gocql.Session.

func New

func New(cfg Settings) (*Session, error)

New creates a new cassandra cluster session using provided settings.

func (*Session) Close

func (s *Session) Close()

Close closes connections to cluster.

func (*Session) ExecRawQuery

func (s *Session) ExecRawQuery(ctx context.Context, q *Query) (map[string][]*TimeSeriesPoint, error)

ExecRawQuery queries cassandra with a Query.Target query and returns a map of time series points grouped by a key column name.

func (*Session) ExecStrictQuery

func (s *Session) ExecStrictQuery(ctx context.Context, q *Query) ([]*TimeSeriesPoint, error)

ExecStrictQuery queries cassandra with passed Query parameters and returns a slice of time series points.

func (*Session) GetColumns

func (s *Session) GetColumns(keyspace, table, needType string) ([]string, error)

GetColumns queries the cassandra cluster for a list of an existing columns of a given type for a given keyspace, table.

func (*Session) GetKeyspaces

func (s *Session) GetKeyspaces(ctx context.Context) ([]string, error)

GetKeyspaces queries the cassandra cluster for a list of existing keyspaces.

func (*Session) GetTables

func (s *Session) GetTables(keyspace string) ([]string, error)

GetTables queries the cassandra cluster for a list of an existing tables in a given keyspace.

func (*Session) Ping

func (s *Session) Ping(ctx context.Context) error

Ping executes a simple query to check the connection status.

type Settings

type Settings struct {
	Hosts       []string
	Keyspace    string
	User        string
	Password    string
	Consistency string
	Timeout     *int
	TLSConfig   *tls.Config
}

type TimeSeriesPoint

type TimeSeriesPoint struct {
	Timestamp time.Time
	Value     float64
}

Jump to

Keyboard shortcuts

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