mongomigrate

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrateFunc

type MigrateFunc func(ctx context.Context, db *mongo.Client) error

MigrateFunc 数据库迁移函数

type Migration

type Migration struct {
	ID       string
	Migrate  MigrateFunc
	Rollback RollbackFunc
}

type MongoMigrate

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

func New

func New(ctx context.Context, mongo *mongo.Client, migrations []*Migration) *MongoMigrate

func (*MongoMigrate) Migrate

func (m *MongoMigrate) Migrate(option ...Option) error

type MongoMigrateTable

type MongoMigrateTable struct {
	ID string `bson:"id"`
}

func (*MongoMigrateTable) CollectionName

func (m *MongoMigrateTable) CollectionName() string

type Option

type Option func(o *Options)

func HasPre

func HasPre() Option

type Options

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

type RollbackFunc

type RollbackFunc func(ctx context.Context, db *mongo.Client) error

RollbackFunc 数据库回滚函数

Jump to

Keyboard shortcuts

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