migrator

package
v1.0.0-beta.16 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMigrator

func DefaultMigrator[T, D any](params MigrateFuncParam[T, D]) error

func MigratePolicy

func MigratePolicy(cfg *raiden.Config, resources []MigrateItem[objects.Policy, objects.UpdatePolicyParam], stateChan chan any, actionFunc MigrateActionFunc[objects.Policy, objects.UpdatePolicyParam]) (errors []error)

func MigrateResource

func MigrateResource[T any, D any](cfg *raiden.Config, resources []MigrateItem[T, D], stateChan chan any, actionFunc MigrateActionFunc[T, D], migrateFunc MigrateFunc[T, D]) (errors []error)

Types

type MigrateActionFunc

type MigrateActionFunc[T, D any] struct {
	CreateFunc MigrateCreateFunc[T]
	UpdateFunc MigrateUpdateFunc[T, D]
	DeleteFunc MigrateDeleteFunc[T]
}

type MigrateCreateFunc

type MigrateCreateFunc[T any] func(cfg *raiden.Config, param T) (response T, err error)

type MigrateDeleteFunc

type MigrateDeleteFunc[T any] func(cfg *raiden.Config, param T) (err error)

type MigrateFunc

type MigrateFunc[T, D any] func(param MigrateFuncParam[T, D]) error

type MigrateFuncParam

type MigrateFuncParam[T, D any] struct {
	Config      *raiden.Config
	StateChan   chan any
	Data        MigrateItem[T, D]
	ActionFuncs MigrateActionFunc[T, D]
}

type MigrateItem

type MigrateItem[T, D any] struct {
	Type           MigrateType
	NewData        T
	OldData        T
	MigrationItems D
}

type MigrateType

type MigrateType string
const (
	MigrateTypeIgnore MigrateType = "ignore"
	MigrateTypeCreate MigrateType = "create"
	MigrateTypeUpdate MigrateType = "update"
	MigrateTypeDelete MigrateType = "delete"
)

type MigrateUpdateFunc

type MigrateUpdateFunc[T, D any] func(cfg *raiden.Config, param T, items D) (err error)

Jump to

Keyboard shortcuts

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