dbmigration

package
v0.0.2-rc-ci Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

type Migration struct {
	Name          string
	MigrationFunc MigrationFunc
	RollbackFunc  MigrationFunc
}

func NewMigration

func NewMigration(name string, migrationFunc, rollbackFunc MigrationFunc) Migration

type MigrationFunc

type MigrationFunc func(ctx context.Context) error

type MigrationService

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

func NewService

func NewService(store Store) *MigrationService

func (*MigrationService) RunMigration

func (m *MigrationService) RunMigration(ctx context.Context, migration Migration) error

func (*MigrationService) RunMigrations

func (m *MigrationService) RunMigrations(ctx context.Context, migrations []Migration) error

type Service

type Service interface {
	RunMigration(ctx context.Context, migration Migration) error
	RunMigrations(ctx context.Context, migrations []Migration) error
}

type SqlStore

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

func NewSqlStore

func NewSqlStore(db *sqlx.DB) (*SqlStore, error)

func (*SqlStore) AddMigration

func (s *SqlStore) AddMigration(ctx context.Context, name string) error

func (*SqlStore) HasMigration

func (s *SqlStore) HasMigration(ctx context.Context, name string) (bool, error)

type Store

type Store interface {
	AddMigration(ctx context.Context, name string) error
	HasMigration(ctx context.Context, name string) (bool, error)
}

Jump to

Keyboard shortcuts

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