Skip to content

Commit bc8b528

Browse files
committed
refactor: move migration codes to usecase.*
1 parent 68f5d4d commit bc8b528

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

gateway/migrate.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package gateway
33
import (
44
"flag"
55
"fmt"
6-
"github.com/pkg/errors"
76
"os"
87

9-
"github.com/vim-volt/volt/gateway/migrate"
8+
"github.com/pkg/errors"
9+
1010
"github.com/vim-volt/volt/logger"
11+
"github.com/vim-volt/volt/usecase"
1112
)
1213

1314
func init() {
@@ -26,7 +27,7 @@ func (cmd *migrateCmd) FlagSet() *flag.FlagSet {
2627
fs.Usage = func() {
2728
args := fs.Args()
2829
if len(args) > 0 {
29-
m, err := migrate.GetMigrater(args[0])
30+
m, err := usecase.GetMigrater(args[0])
3031
if err != nil {
3132
return
3233
}
@@ -72,7 +73,7 @@ func (cmd *migrateCmd) Run(cmdctx *CmdContext) *Error {
7273
return nil
7374
}
7475

75-
func (cmd *migrateCmd) parseArgs(args []string) (migrate.Migrater, error) {
76+
func (cmd *migrateCmd) parseArgs(args []string) (usecase.Migrater, error) {
7677
fs := cmd.FlagSet()
7778
fs.Parse(args)
7879
if cmd.helped {
@@ -82,11 +83,11 @@ func (cmd *migrateCmd) parseArgs(args []string) (migrate.Migrater, error) {
8283
if len(args) == 0 {
8384
return nil, errors.New("please specify migration operation")
8485
}
85-
return migrate.GetMigrater(args[0])
86+
return usecase.GetMigrater(args[0])
8687
}
8788

8889
func (cmd *migrateCmd) showAvailableOps(write func(string)) {
89-
for _, m := range migrate.ListMigraters() {
90+
for _, m := range usecase.ListMigraters() {
9091
write(fmt.Sprintf(" %s", m.Name()))
9192
write(fmt.Sprintf(" %s", m.Description(true)))
9293
}

gateway/migrate/lockjson.go usecase/migrate-lockjson.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package migrate
1+
package usecase
22

33
import (
44
"github.com/pkg/errors"

gateway/migrate/plugconf-config-func.go usecase/migrate-plugconf-config-func.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package migrate
1+
package usecase
22

33
import (
44
"io/ioutil"

gateway/migrate/migrater.go usecase/migrate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package migrate
1+
package usecase
22

33
import (
44
"sort"

0 commit comments

Comments
 (0)