migrationnotes.go 633 B

123456789101112131415161718192021222324252627
  1. package migrationnotes
  2. import (
  3. "github.com/urfave/cli"
  4. "github.com/zeromicro/go-zero/tools/goctl/config"
  5. "github.com/zeromicro/go-zero/tools/goctl/util/format"
  6. )
  7. // BeforeCommands run before comamnd run to show some migration notes
  8. func BeforeCommands(ctx *cli.Context) error {
  9. if err := migrateBefore1_3_4(ctx); err != nil {
  10. return err
  11. }
  12. return nil
  13. }
  14. func getModelSuffix(style string) (string, error) {
  15. cfg, err := config.NewConfig(style)
  16. if err != nil {
  17. return "", err
  18. }
  19. baseSuffix, err := format.FileNamingFormat(cfg.NamingFormat, "_model")
  20. if err != nil {
  21. return "", err
  22. }
  23. return baseSuffix + ".go", nil
  24. }