You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/tools/goctl/model/mongomodel/genmongocmd.go

30 lines
528 B
Go

4 years ago
package mongomodel
import (
"errors"
"fmt"
"github.com/logrusorgru/aurora"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/tools/goctl/model/mongomodel/gen"
4 years ago
"github.com/urfave/cli"
)
func ModelCommond(c *cli.Context) error {
src := c.String("src")
cache := c.String("cache")
if len(src) == 0 {
return errors.New("missing -src")
}
var needCache bool
if cache == "yes" {
needCache = true
}
lang.Must(gen.GenMongoModel(src, needCache))
fmt.Println(aurora.Green("Done."))
return nil
}