migration

package
v0.0.0-...-6a130d5 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareMigrations

func CompareMigrations(left *Migration, right *Migration) bool

CompareMigrations compares two migrations and returns `true` if `left` migration is less.

func DummyUpDown

func DummyUpDown(client *kivik.Client, dbPrefix string) error

DummyUpDown is a dummy migration function.

Types

type ApplyFunc

type ApplyFunc func(client *kivik.Client, dbPrefix string) error

ApplyFunc declares func type for migration functions

type Migration

type Migration struct {
	ID      string    `json:"_id,omitempty"`
	Version int64     `json:"version"`
	Name    string    `json:"name"`
	Up      ApplyFunc `json:"-"`
	Down    ApplyFunc `json:"-"`
	Stored  bool      `json:"-"`
}

Migration declares a migration data structure.

func (*Migration) Eq

func (mig *Migration) Eq(migration *Migration) bool

Eq returns `true` if migrations version are equal.

func (*Migration) Less

func (mig *Migration) Less(migration *Migration) bool

Less returns `true` if an argument is more than current.

type Migrations

type Migrations []Migration

Migrations type declares a slice-type of `Migration` with an implementation of `sort.Sort` interface.

func (Migrations) Len

func (ms Migrations) Len() int

func (Migrations) Less

func (ms Migrations) Less(i int, j int) bool

func (Migrations) Swap

func (ms Migrations) Swap(i int, j int)

Jump to

Keyboard shortcuts

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