migrator

package
v0.0.0-...-a8824c5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migrator

type Migrator struct {
	ScriptDir          string
	DBName             string
	MongoClientOptions *options.ClientOptions
	// contains filtered or unexported fields
}

func NewMigrator

func NewMigrator(mongoClientOptions *options.ClientOptions, dbName, scriptDir string) (*Migrator, error)

NewMigrator creates a new Migrator instance

func (*Migrator) Down

func (m *Migrator) Down() error

Down applies all down migrations in the scripts directory that have been applied

func (*Migrator) LatestVersion

func (m *Migrator) LatestVersion() (string, error)

LatestVersion retrieves the latest applied migration version from the database

func (*Migrator) Up

func (m *Migrator) Up() error

Up applies all up migrations in the scripts directory that haven't been applied yet

Jump to

Keyboard shortcuts

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