-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmigrate.go
More file actions
28 lines (24 loc) · 884 Bytes
/
Copy pathmigrate.go
File metadata and controls
28 lines (24 loc) · 884 Bytes
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
package dlq
// MigrateDedupOption configures a backend's MigrateDedup operation.
type MigrateDedupOption func(*migrateDedupOptions)
// migrateDedupOptions holds configuration for MigrateDedup (unexported).
type migrateDedupOptions struct {
force bool
}
// WithForce allows MigrateDedup to proceed even when collapsing historical
// duplicates would delete more than half of all rows. Without it, MigrateDedup
// refuses such a large deletion and returns an error, as a safety guard against
// running it against the wrong collection/table.
func WithForce() MigrateDedupOption {
return func(o *migrateDedupOptions) {
o.force = true
}
}
// applyMigrateDedupOptions builds a migrateDedupOptions from the given options.
func applyMigrateDedupOptions(opts []MigrateDedupOption) migrateDedupOptions {
var o migrateDedupOptions
for _, opt := range opts {
opt(&o)
}
return o
}