migration

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 3 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(db *mongo.Database) error

DummyUpDown is a dummy migration function.

func MajorityOpts

func MajorityOpts() *options.CollectionOptions

MajorityOpts returns `writeConcern: "majority"` collection option.

Types

type ApplyFunc

type ApplyFunc func(db *mongo.Database) error

ApplyFunc declares func type for migration functions

type Migration

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

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