versioning

package
v0.0.0-...-5c26bad Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureTableExists

func EnsureTableExists(session *gocql.Session) error

EnsureTableExists makes sure the schema version table is present

Types

type IMaintainVersions

type IMaintainVersions interface {
	ApplyChanges(stmts []string) error
	AddVersion(version int, description string, appliedOn time.Time) error
	RemoveVersion(version int) error
}

IMaintainVersions performs update to the schema and its info table

type IManageVersions

type IManageVersions interface {
	GetPreviousVersion() (int, int, error)
	GetCurrentVersion() (int, error)
	ApplyChanges(stmts []string) error
	AddVersion(version int, description string, appliedOn time.Time) error
	RemoveVersion(version int) error
}

IManageVersions manages interactions with the Schema Info table

type IRecallVersions

type IRecallVersions interface {
	GetPreviousVersion() (int, int, error)
	GetCurrentVersion() (int, error)
}

IRecallVersions can retrieve current and previous version from the info table

type VersionService

type VersionService struct {
	Session *gocql.Session
}

VersionService is a concrete implementation of IManageVersions

func (*VersionService) AddVersion

func (vs *VersionService) AddVersion(version int, description string, appliedOn time.Time) error

AddVersion inserts a new updated version of the schema to the info table

func (*VersionService) ApplyChanges

func (vs *VersionService) ApplyChanges(stmts []string) (err error)

ApplyChanges execute cql script

func (*VersionService) GetCurrentVersion

func (vs *VersionService) GetCurrentVersion() (int, error)

GetCurrentVersion returns the current version of the database schema

func (*VersionService) GetPreviousVersion

func (vs *VersionService) GetPreviousVersion() (int, int, error)

GetPreviousVersion returns the previous version of the database schema

func (*VersionService) RemoveVersion

func (vs *VersionService) RemoveVersion(version int) error

RemoveVersion inserts a new updated version of the schema to the info table

Jump to

Keyboard shortcuts

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