-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalregistry.go
34 lines (25 loc) · 1.06 KB
/
globalregistry.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
package conduit
import (
"io/fs"
"go.inout.gg/conduit/conduitregistry"
)
const (
// GlobalRegistryNamespace is the namespace of the global registry.
//
// The global registry is used by default by the Migrator when no
// alternative registry is provided via Config.
GlobalRegistryNamespace = "global"
)
var globalRegistry = conduitregistry.New(GlobalRegistryNamespace)
// Up registers an up migration function in the global registry.
func Up(up MigrateFunc) { globalRegistry.Up(up) }
// UpTx registers an up migration function that runs in a transaction in the global registry.
func UpTx(up MigrateFuncTx) { globalRegistry.UpTx(up) }
// Down registers a down migration function in the global registry.
func Down(down MigrateFunc) { globalRegistry.Down(down) }
// DownTx registers a down migration function that runs in a transaction in the global registry.
func DownTx(down MigrateFuncTx) { globalRegistry.DownTx(down) }
// FromFS registers SQL migrations from the provided filesystem in the global registry.
func FromFS(fsys fs.FS) {
globalRegistry.FromFS(fsys)
}