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: 16 Imported by: 0

README

Cassandra migration package

This package helps to apply schema changes via a wrapper written on top migration package.

The tests under this covers both db-create and db-migrate of Cassandra.

Documentation

Overview

Package migrate contains ...

Index

Constants

View Source
const (
	LockTTLSeconds = 30
)

Variables

View Source
var (
	ErrNilConfig     = errors.New("no config")
	ErrNoKeyspace    = errors.New("no keyspace provided")
	ErrDatabaseDirty = errors.New("database is dirty")
	ErrClosedSession = errors.New("session is closed")
)
View Source
var DefaultMigrationsTable = "schema_migrations"
View Source
var (
	DefaultMultiStatementMaxSize = 10 * 1 << 20 // 10 MB
)

Functions

func WithInstance

func WithInstance(session *gocql.Session, config *Config) (database.Driver, error)

Types

type Cassandra

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

func (*Cassandra) Close

func (c *Cassandra) Close() error

func (*Cassandra) Drop

func (c *Cassandra) Drop() error

func (*Cassandra) Lock

func (c *Cassandra) Lock() error

func (*Cassandra) Open

func (c *Cassandra) Open(url string) (database.Driver, error)

func (*Cassandra) Run

func (c *Cassandra) Run(migration io.Reader) error

func (*Cassandra) SetVersion

func (c *Cassandra) SetVersion(version int, dirty bool) error

func (*Cassandra) Unlock

func (c *Cassandra) Unlock() error

func (*Cassandra) Version

func (c *Cassandra) Version() (version int, dirty bool, err error)

Return current keyspace version

type CassandraMigrate

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

func NewCassandraMigrate

func NewCassandraMigrate(log logging.Logger) (*CassandraMigrate, error)

func (*CassandraMigrate) Run

func (c *CassandraMigrate) Run() error

type Config

type Config struct {
	MigrationsTable       string
	KeyspaceName          string
	MultiStatementEnabled bool
	MultiStatementMaxSize int
}

type DBConfig

type DBConfig struct {
	DbDsn       string `envconfig:"DB_ADDRESSES" required:"true"`
	DbName      string `envconfig:"CASSANDRA_DB_NAME" required:"true"`
	Username    string `envconfig:"DB_SERVICE_USERNAME" required:"true"`
	Password    string `envconfig:"DB_SERVICE_PASSWD" required:"true"`
	Consistency string `envconfig:"CASSANDRA_CONSISTENCY" default:"ALL"`
	SourceURI   string `envconfig:"SOURCE_URI" default:"file:///migrations"`
}

Jump to

Keyboard shortcuts

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