Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GenModel = &cobra.Command{ Use: "gen-model", Short: "A brief description of your command", Long: `A longer description that spans multiple lines and likely contains examples`, Run: func(cmd *cobra.Command, args []string) { cfg, err := config.NewConfig() if err != nil { log.Fatalf("Config error: %s", err) } if viper.GetString("pg_addr") != "" { cfg.PG.URL = viper.GetString("pg_addr") } pwd, _ := os.Getwd() g := gen.NewGenerator(gen.Config{ OutPath: pwd + "/internal/entity/query", Mode: gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface, }) gormdb, err := gorm.Open(postgres.Open(cfg.PG.URL)) if err != nil { fmt.Errorf("gorm.Open err:%s", err.Error()) } g.UseDB(gormdb) g.GenerateAllTable() g.Execute() fmt.Println("gen model success") }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.