Documentation ¶
Index ¶
- Variables
- func NumericFromFilename(filename string) (int64, error)
- func Register(up Step)
- func VersionsToApply(versions []int64, current, target int64) (result []int64)
- type ApplyError
- type Collection
- type Locker
- type Logger
- type Option
- type Provider
- func (p *Provider) Migrate(ctx context.Context, targetVersion int64) (*Result, error)
- func (p *Provider) ReadSchemaVersion(ctx context.Context) (version int64, err error)
- func (p *Provider) Status(ctx context.Context) (status *Status, err error)
- func (p *Provider) UpdateSchemaVersion(ctx context.Context, version int64) error
- type RegisterError
- type Result
- type Status
- type Step
- type StepFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaulCollection = NewCollection()
View Source
var DefaultOptions = []Option{ VersionSchemaName("schema_migrate"), VersionTableName("schema_version"), WithCollection(DefaulCollection), WithLocker(NewPostgresAdvisoryLocker(advisoryLockNumber)), WithLogger(NewSLogLogger(slog.Default())), }
Functions ¶
func NumericFromFilename ¶
func VersionsToApply ¶
Types ¶
type ApplyError ¶
type ApplyError struct {
// contains filtered or unexported fields
}
func (ApplyError) Error ¶
func (e ApplyError) Error() string
func (ApplyError) Unwrap ¶
func (e ApplyError) Unwrap() error
type Collection ¶
type Collection interface { Step(version int64) (Step, bool) Versions() []int64 Register(filename string, step Step) error }
func NewCollection ¶
func NewCollection() Collection
type Locker ¶
type Locker interface { Lock(ctx context.Context, conn *pgx.Conn) error Unlock(ctx context.Context, conn *pgx.Conn) error }
type Logger ¶
type Logger interface { LogNoVersionToApply(ctx context.Context, all, toApply []int64, currentVersion, targetVersion int64) LogVersionsToApply(ctx context.Context, all, toApply []int64, currentVersion, targetVersion int64) LogVersionApplyStart(ctx context.Context, version int64) LogVersionApplyDone(ctx context.Context, version int64) }
func NewSLogLogger ¶
type Option ¶
type Option func(*opts)
func VersionSchemaName ¶
func VersionTableName ¶
func WithCollection ¶
func WithCollection(c Collection) Option
func WithLocker ¶
func WithLogger ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func (*Provider) ReadSchemaVersion ¶
type RegisterError ¶
type RegisterError struct {
// contains filtered or unexported fields
}
func (RegisterError) Error ¶
func (e RegisterError) Error() string
func (RegisterError) Unwrap ¶
func (e RegisterError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.