generate.go 692 B

12345678910111213141516171819202122232425262728
  1. package cmd
  2. import (
  3. "gadmin/internal/generate"
  4. "github.com/sirupsen/logrus"
  5. "github.com/spf13/cobra"
  6. )
  7. var generateCmd = &cobra.Command{
  8. Use: "gendbmodel",
  9. Short: "根据gorm数据库表,直接生成gorm模型和相应的查询gen",
  10. Long: `A longer description that spans multiple lines and likely contains examples
  11. and usage of using your command. For example:
  12. Cobra is a CLI library for Go that empowers applications.
  13. This application is a tool to generate the needed files
  14. to quickly create a Cobra application.`,
  15. Run: func(cmd *cobra.Command, args []string) {
  16. logrus.Info("generate called")
  17. generate.GenModel()
  18. },
  19. }
  20. func init() {
  21. rootCmd.AddCommand(generateCmd)
  22. }