Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "crud [flags]", Short: "Generate CRUD source code of type", Args: func(cmd *cobra.Command, args []string) error { if name == "" { return errors.New("need the type name") } return nil }, RunE: func(cmd *cobra.Command, args []string) error { if pkgname == "" { i, err := build.Import(".", ".", 0) if err == nil { pkgname = i.Name } } if pkgname == "" { pkgname = "main" } g := crud.NewGenCrud() data, err := g.Generate(tplname, pkgname, name) if err != nil { return err } if out == "" { out = namecase.ToLowerSnake(name) + ".go" } if data0, err := format.Source(data); err == nil { data = data0 } err = ioutil.WriteFile(out, data, 0666) if err != nil { return err } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.