dao

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMigrationRunning = errors.New("migration is running")

ErrMigrationRunning is returned when an operation is blocked because the migration is currently in the "running" state (e.g. delete while running).

Functions

func CreateMigration

func CreateMigration(m *model.Migration) error

CreateMigration persists a new Migration.

Inline connection credentials and the beetleDb password in the plan are encrypted before writing. The call is idempotent in practice: a plan that arrived from POST /plans/target is already ciphertext and is stored as it came, while a hand-written plaintext plan is sealed here.

func CreateMigrationLog

func CreateMigrationLog(entry *model.MigrationLog) error

CreateMigrationLog persists a single MigrationLog entry.

func DeleteMigration

func DeleteMigration(id string) error

DeleteMigration deletes the Migration with the given ID. Returns ErrMigrationRunning when status is "running". Returns gorm.ErrRecordNotFound when no row matches.

func FailInterruptedValidations

func FailInterruptedValidations() (int64, error)

FailInterruptedValidations marks every validation still recorded as running failed, and returns how many there were.

A validation runs in a goroutine of this process, so at startup none can be running: a "running" row is one a restart cut short. Left alone it would read as running for good, and StartValidation would refuse it with 409 forever.

func GetMigration

func GetMigration(id string) (*model.Migration, error)

GetMigration returns the Migration with the given ID, its plan still encrypted.

Nothing is decrypted here. The migration resolvers decrypt one ref at a time as they build each transfer, so a plan decrypted this early would only mean plaintext credentials sitting in every caller — including the ones whose answer goes straight into an HTTP response.

func ListAllMigration

func ListAllMigration(f model.MigrationListFilter) ([]model.MigrationSummary, error)

ListAllMigration returns every migration summary matching f, ordered by created_at DESC, without pagination. The caller is responsible for bounding the result — see MigrationListFilter.ApplyDefaultWindow.

func ListAllMigrationLog

func ListAllMigrationLog(migrationID, status string) ([]model.MigrationLog, error)

ListAllMigrationLog returns every log for migrationID without pagination, optionally filtered by status ("success" | "failed" | "skipped").

func ListMigration

func ListMigration(f model.MigrationListFilter, page, pageSize int) ([]model.MigrationSummary, int64, error)

ListMigration returns a paginated list of migration summaries matching f, ordered by created_at DESC.

func ListMigrationLog

func ListMigrationLog(migrationID, status string, page, pageSize int) ([]model.MigrationLog, int64, error)

ListMigrationLog returns a paginated list of logs for migrationID, optionally filtered by status ("success" | "failed" | "skipped").

func UpdateMigrationStatus

func UpdateMigrationStatus(m *model.Migration) error

UpdateMigrationStatus updates only the status and progress fields, leaving the plan column untouched. Use this during execution to avoid re-encrypting the plan on every progress tick.

func UpdateMigrationValidation

func UpdateMigrationValidation(m *model.Migration) error

UpdateMigrationValidation updates only the validation fields (status, message, details), leaving plan, status, and progress columns untouched. Use this after a validation run completes to persist results without re-encrypting the plan.

Types

This section is empty.

Jump to

Keyboard shortcuts

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