sqlboiler/cmds/insert.go
Patrick O'brien 20720b2cc0 Changed SQLBoiler init method
* Now uses maps to load commands
* Map for custom run handlers
* Map for template functions
* Streamlined cmd creation process
2016-02-29 15:49:26 +10:00

43 lines
1.2 KiB
Go

package cmds
// // init the "insert" command
// func init() {
// SQLBoiler.AddCommand(insertCmd)
// insertCmd.Run = insertRun
// }
//
// var insertCmd = &cobra.Command{
// Use: "insert",
// Short: "Generate insert statement helpers from table definitions",
// }
//
// // insertRun executes the insert command, and generates the insert statement
// // boilerplate from the template file.
// func insertRun(cmd *cobra.Command, args []string) {
// err := outHandler(generateInserts())
// if err != nil {
// errorQuit(err)
// }
// }
//
// // generateInserts returns a slice of each template execution result.
// // Each of these results holds an insert statement generated from the insert template.
// func generateInserts() [][]byte {
// t, err := template.New("insert.tpl").Funcs(template.FuncMap{
// "makeGoColName": makeGoColName,
// "makeDBColName": makeDBColName,
// "makeGoInsertParamNames": makeGoInsertParamNames,
// "makeGoInsertParamFlags": makeGoInsertParamFlags,
// }).ParseFiles("templates/insert.tpl")
//
// if err != nil {
// errorQuit(err)
// }
//
// outputs, err := processTemplate(t)
// if err != nil {
// errorQuit(err)
// }
//
// return outputs
// }