aboutsummaryrefslogtreecommitdiffstats
path: root/internal/bolttest/mock_migration_executor.go
blob: 74eda4fbedd16f325a71c56f50cd4f77c8b232dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package bolttest

import "git.sr.ht/~eugenetriguba/bolt/internal/models"

type MockMigrationExecutor struct {
	ApplyReturnValue  ExecutorApplyReturnValue
	ApplyCallCount    int
	RevertReturnValue ExecutorRevertReturnValue
	RevertCallCount   int
}

type ExecutorApplyReturnValue struct {
	Err error
}

type ExecutorRevertReturnValue = ExecutorApplyReturnValue

func (e *MockMigrationExecutor) Apply(migration *models.Migration) error {
	e.ApplyCallCount++
	return e.ApplyReturnValue.Err
}

func (e *MockMigrationExecutor) Revert(migration *models.Migration) error {
	e.RevertCallCount++
	return e.RevertReturnValue.Err
}