generate_sql.go 662 B

12345678910111213141516171819202122232425262728
  1. package cmd
  2. import (
  3. "gadmin/internal/generate"
  4. "github.com/sirupsen/logrus"
  5. "github.com/spf13/cobra"
  6. )
  7. var generateSqlCmd = &cobra.Command{
  8. Use: "gendbtable",
  9. Short: "根据model生成数据表",
  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 sql called")
  17. generate.GenDbTable()
  18. },
  19. }
  20. func init() {
  21. rootCmd.AddCommand(generateSqlCmd)
  22. }