-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoption.go
46 lines (40 loc) · 1.29 KB
/
option.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package adapt
import (
"log/slog"
)
// Option can modify the behaviour of Migrate and/or provide additional configuration
// values, like custom contract.Logger
type Option func(*exec) error
// DisableHashIntegrityChecks disables the hash integrity checks of SqlStatementsSource
// migrations against the already applied ones. By default adapt always performs these
// checks to protect against unwanted changes to SQL-Statements scripts after they have
// already been applied to your Driver. Disabling it should be done with caution!
func DisableHashIntegrityChecks() Option {
return func(e *exec) error {
e.optDisableHashIntegrityChecks = true
return nil
}
}
// DisableDriverLocks disables mutex acquiring/releasing of a Driver, even if the Driver
// itself reports to support locking.
func DisableDriverLocks() Option {
return func(e *exec) error {
e.optDisableDriverLocks = true
return nil
}
}
// CustomLogger provides a custom contract.Logger implementation to adapt. It will be
// used within the whole module and passed down to Driver and Source children.
func CustomLogger(log *slog.Logger) Option {
return func(e *exec) error {
e.log = log
return nil
}
}
// DisableLogger fully disables logging output
func DisableLogger() Option {
return func(e *exec) error {
// TODO
return nil
}
}