cassandra

package
v0.0.0-...-bd5401e Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cassandra contains the domain concept definitions needed to support Magistrala Cassandra database functionality.

It provides the abstraction of the Cassandra database service, which is used to configure, setup and connect to the Cassandra database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(cfg Config) (*gocql.Session, error)

Connect establishes connection to the Cassandra cluster.

func InitDB

func InitDB(cs *gocql.Session, query string) error

func Setup

func Setup(envPrefix string) (*gocql.Session, error)

Setup load configuration from environment and creates new cassandra connection.

func SetupDB

func SetupDB(envPrefix, initQuery string) (*gocql.Session, error)

SetupDB load configuration from environment, creates new cassandra connection and executes the initial query in database.

Types

type Config

type Config struct {
	Hosts    []string `env:"CLUSTER"     envDefault:"127.0.0.1" envSeparator:","`
	Keyspace string   `env:"KEYSPACE"    envDefault:"magistrala"`
	User     string   `env:"USER"        envDefault:""`
	Pass     string   `env:"PASS"        envDefault:""`
	Port     int      `env:"PORT"        envDefault:"9042"`
}

Config contains Cassandra DB specific parameters.

Jump to

Keyboard shortcuts

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