cassandra

package
v0.0.0-...-73f03d9 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cassandra contains ...

Package cassandra contains ...

Package cassandra contains ...

Package cassandra contains ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(dbAddress []string, dbAdminUsername string, dbAdminPassword string) (*gocql.Session, error)

Types

type DBConfig

type DBConfig struct {
	DbAddresses         []string `envconfig:"CASSANDRA_SERVICE_URL" default:"localhost:9042"`
	DbAdminUsername     string   `envconfig:"CASSANDRA_USERNAME" default:"user"`
	DbServiceUsername   string   `envconfig:"DB_SERVICE_USERNAME" default:"user"`
	DbName              string   `envconfig:"CASSANDRA_KEYSPACE_NAME" default:"capten"`
	DbReplicationFactor string   `envconfig:"DB_REPLICATION_FACTOR" default:"1"`
	DbAdminPassword     string   `envconfig:"CASSANDRA_PASSWORD" default:"password"`
	DbServicePassword   string   `envconfig:"DB_SERVICE_PASSWD" default:"password"`
}

func GetDbConfig

func GetDbConfig() (*DBConfig, error)

type DbConfigurator

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

func NewDbConfigurator

func NewDbConfigurator(logger logging.Logger, store Store) (handler *DbConfigurator)

func (*DbConfigurator) ConfigureDb

func (dbConf *DbConfigurator) ConfigureDb(conf DBConfig) (err error)

type Store

type Store interface {
	Close()
	InsertToolsDb(data *model.ClimonPostRequest) error
	DeleteToolsDbEntry(data *model.ClimonDeleteRequest) error
	CreateDbUser(serviceUsername string, servicePassword string) (err error)
	GrantPermission(serviceUsername string, dbName string) (err error)
	CreateDb(keyspace, dbName string, replicationFactor string) (err error)
	CreateLockSchemaDb(replicationFactor string) (err error)
}

func Create

func Create(log logging.Logger) (Store, error)

func NewCassandraStore

func NewCassandraStore(logger logging.Logger, dbAddress []string, username, password string) (Store, error)

Jump to

Keyboard shortcuts

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