cassandra

package
v0.0.0-...-4440402 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Row

type Row struct {
	Columns []string
	Fields  map[string]interface{}
}

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

func (*Session) Select

func (s *Session) Select(ctx context.Context, query string, values ...interface{}) (rows map[string][]Row, err error)

Select queries the database with provided query string and returns result rows grouped by ID. ID must be a first requested column in query and must be convertable to a string.

type Settings

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

Settings is a set of Cassandra session settings.

Jump to

Keyboard shortcuts

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