[chore] Update a bunch of database dependencies (#1772)

* [chore] Update a bunch of database dependencies

* fix lil thing
This commit is contained in:
tobi 2023-05-12 14:33:40 +02:00 committed by GitHub
commit ec325fee14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
402 changed files with 35068 additions and 35401 deletions

View file

@ -217,6 +217,7 @@ func (m *Migrator) Rollback(ctx context.Context, opts ...MigrationOption) (*Migr
type goMigrationConfig struct {
packageName string
goTemplate string
}
type GoMigrationOption func(cfg *goMigrationConfig)
@ -227,12 +228,19 @@ func WithPackageName(name string) GoMigrationOption {
}
}
func WithGoTemplate(template string) GoMigrationOption {
return func(cfg *goMigrationConfig) {
cfg.goTemplate = template
}
}
// CreateGoMigration creates a Go migration file.
func (m *Migrator) CreateGoMigration(
ctx context.Context, name string, opts ...GoMigrationOption,
) (*MigrationFile, error) {
cfg := &goMigrationConfig{
packageName: "migrations",
goTemplate: goTemplate,
}
for _, opt := range opts {
opt(cfg)
@ -245,7 +253,7 @@ func (m *Migrator) CreateGoMigration(
fname := name + ".go"
fpath := filepath.Join(m.migrations.getDirectory(), fname)
content := fmt.Sprintf(goTemplate, cfg.packageName)
content := fmt.Sprintf(cfg.goTemplate, cfg.packageName)
if err := ioutil.WriteFile(fpath, []byte(content), 0o644); err != nil {
return nil, err