Documentation
¶
Index ¶
- Variables
- func SourceFromDirectory(dbGetter func() DBExecer, folder string) (migrations.Source, error)
- func SourceFromFS(dbGetter func() DBExecer, fs fs.ReadDirFS, folder string) (migrations.Source, error)
- type DB
- type DBExecer
- type Target
- func (target *Target) Add(ctx context.Context, id string) error
- func (target *Target) Create(ctx context.Context) error
- func (target *Target) Current(ctx context.Context) (string, error)
- func (target *Target) Destroy(ctx context.Context) error
- func (target *Target) Done(ctx context.Context) ([]string, error)
- func (target *Target) FinishMigration(ctx context.Context, id string) error
- func (target *Target) Lock(ctx context.Context) (migrations.Unlocker, error)
- func (target *Target) Remove(ctx context.Context, id string) error
- func (target *Target) StartMigration(ctx context.Context, id string) error
- type TargetOption
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidMigrationDirection = errors.New("invalid migration direction")
)
Functions ¶
func SourceFromDirectory ¶
SourceFromDirectory creates a new source based on the provided folder in the disk.
func SourceFromFS ¶
func SourceFromFS(dbGetter func() DBExecer, fs fs.ReadDirFS, folder string) (migrations.Source, error)
SourceFromFS creates a new source based on the provided fs.ReadDirFS and folder. This is useful for creating a source based on a virtual filesystem (for example `go:embed`). Example:
//go:embed migrations var migrationsFS embed.FS source, err := sql.SourceFromFS(dbGetter, migrationsFS, "migrations")
Types ¶
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
func (*Target) FinishMigration ¶
type TargetOption ¶
type TargetOption func(target *targetOpts) error
func WithDriver ¶
func WithDriver(driver drivers.Driver) TargetOption
func WithDriverOptions ¶
func WithDriverOptions(options ...drivers.Option) TargetOption
func WithTableName ¶
func WithTableName(tableName string) TargetOption
Click to show internal directories.
Click to hide internal directories.