gossage

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: BSD-3-Clause Imports: 5 Imported by: 14

README

gossage

Build Go Report Card

cockroachdb database migration library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger func(format string, a ...interface{})

Functions

This section is empty.

Types

type ByVersion

type ByVersion []Migration

func (ByVersion) Len

func (v ByVersion) Len() int

func (ByVersion) Less

func (v ByVersion) Less(i, j int) bool

func (ByVersion) Swap

func (v ByVersion) Swap(i, j int)

type Gossage

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

func New

func New(db *sql.DB) (*Gossage, error)

func (*Gossage) DownTo

func (g *Gossage) DownTo(version string) error

func (*Gossage) RegisterMigrations

func (g *Gossage) RegisterMigrations(migrations ...Migration) error

func (*Gossage) Up

func (g *Gossage) Up() error

type Migration

type Migration interface {
	Version() string
	Up(*sql.Tx) error
	Down(*sql.Tx) error
}

type MigrationHistory

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

func NewMigrationHistory

func NewMigrationHistory(db *sql.DB) *MigrationHistory

func (*MigrationHistory) AddMigration

func (mh *MigrationHistory) AddMigration(m Migration) error

func (*MigrationHistory) Initialize

func (mh *MigrationHistory) Initialize() error

func (*MigrationHistory) LatestVersion

func (mh *MigrationHistory) LatestVersion() (Version, error)

func (*MigrationHistory) RevertMigration

func (mh *MigrationHistory) RevertMigration(version string) error

func (*MigrationHistory) VersionsGreaterThan

func (mh *MigrationHistory) VersionsGreaterThan(version string) ([]string, error)

type Version

type Version struct {
	Id      string
	Version string
	Applied bool
	Created time.Time
	Updated time.Time
}

Directories

Path Synopsis
cmd
gossage command
internal
cli

Jump to

Keyboard shortcuts

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