driver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package driver provides the MigrationDriver adapter and in-process registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter wraps any MigrationDriver and adds optional pre/post hooks.

func NewAdapter

func NewAdapter(d Driver) *Adapter

NewAdapter wraps a MigrationDriver in an Adapter.

func (*Adapter) Down

func (a *Adapter) Down(ctx context.Context, req Request) (Result, error)

Down delegates to the inner driver.

func (*Adapter) Goto

func (a *Adapter) Goto(ctx context.Context, req Request, target string) (Result, error)

Goto delegates to the inner driver.

func (*Adapter) Name

func (a *Adapter) Name() string

Name delegates to the inner driver.

func (*Adapter) Status

func (a *Adapter) Status(ctx context.Context, req Request) (Status, error)

Status delegates to the inner driver.

func (*Adapter) Up

func (a *Adapter) Up(ctx context.Context, req Request) (Result, error)

Up delegates to the inner driver.

type Driver

type Driver = interfaces.MigrationDriver

Driver is a thin alias so callers can import from this package without directly depending on the interfaces package.

type Options

type Options = interfaces.MigrationOptions

Options is an alias for interfaces.MigrationOptions.

type Registry

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

Registry is a thread-safe in-process registry of named MigrationDrivers.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty Registry.

func (*Registry) Get

func (r *Registry) Get(name string) (Driver, error)

Get returns the driver with the given name, or an error if not found.

func (*Registry) MustRegister

func (r *Registry) MustRegister(d Driver)

MustRegister is like Register but panics on error.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns the sorted list of registered driver names.

func (*Registry) Register

func (r *Registry) Register(d Driver) error

Register adds a driver to the registry. Returns an error if a driver with the same name is already registered.

type Request

type Request = interfaces.MigrationRequest

Request is an alias for interfaces.MigrationRequest.

type Result

type Result = interfaces.MigrationResult

Result is an alias for interfaces.MigrationResult.

type Source

type Source = interfaces.MigrationSource

Source is an alias for interfaces.MigrationSource.

type Status

type Status = interfaces.MigrationStatus

Status is an alias for interfaces.MigrationStatus.

Jump to

Keyboard shortcuts

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