Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Build string Version string )
View Source
var RootCmd = &cobra.Command{ Use: "dbgen", Short: "Generate a set of go types and protobuf files from a set of database tables", Long: ` Generate a set of go types and protobuf files from a set of database tables Example: dbgen --database foo --dir ./gen `, Run: func(cmd *cobra.Command, args []string) { if database == "" { fmt.Println("database name is required") os.Exit(1) } if dir == "" { fmt.Println("directory name is required") os.Exit(1) } dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s", username, password, hostname, port, database) db, err := sqlx.Connect("mysql", dsn) if err != nil { fmt.Println(err) os.Exit(1) } defer db.Close() if err := gen.Generate(db, database, pkg, dir); err != nil { fmt.Println(err) os.Exit(1) } }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.