migration

package
v2.38.2-0...-94d1eb7 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StartedType = eventstore.EventType("system.migration.started")
	DoneType    = eventstore.EventType("system.migration.done")

	SystemAggregate   = eventstore.AggregateType("system")
	SystemAggregateID = "SYSTEM"
)

Variables

This section is empty.

Functions

func CancelStep

func CancelStep(ctx context.Context, es *eventstore.Eventstore, step *SetupStep) error

func Migrate

func Migrate(ctx context.Context, es *eventstore.Eventstore, migration Migration) (err error)

func SetupMapper

func SetupMapper(event eventstore.Event) (eventstore.Event, error)

Types

type Migration

type Migration interface {
	String() string
	Execute(ctx context.Context, startedEvent eventstore.Event) error
}

type RepeatableMigration

type RepeatableMigration interface {
	Migration
	Check(lastRun map[string]interface{}) bool
}

type SetupStep

type SetupStep struct {
	eventstore.BaseEvent `json:"-"`

	Name    string `json:"name"`
	Error   any    `json:"error,omitempty"`
	LastRun any    `json:"lastRun,omitempty"`
	// contains filtered or unexported fields
}

SetupStep is the command pushed on the eventstore

func LastStuckStep

func LastStuckStep(ctx context.Context, es *eventstore.Eventstore) (*SetupStep, error)

func (*SetupStep) Payload

func (s *SetupStep) Payload() interface{}

func (*SetupStep) UniqueConstraints

func (s *SetupStep) UniqueConstraints() []*eventstore.UniqueConstraint

type Step

type Step struct {
	*SetupStep
	// contains filtered or unexported fields
}

type StepState

type StepState int32
const (
	StepStarted StepState = iota
	StepDone
	StepFailed
)

type StepStates

type StepStates struct {
	eventstore.ReadModel
	Steps []*Step
}

func (*StepStates) Query

Query implements eventstore.QueryReducer.

func (*StepStates) Reduce

func (s *StepStates) Reduce() error

Reduce implements eventstore.QueryReducer.

Jump to

Keyboard shortcuts

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