Files
go-zero/tools/goctl/model/sql/template/insert.go

9 lines
392 B
Go
Raw Normal View History

2020-08-12 09:19:37 +08:00
package template
2020-07-29 17:11:41 +08:00
var Insert = `
2020-08-16 23:28:01 +08:00
func (m *{{.upperStartCamelObject}}Model) Insert(data {{.upperStartCamelObject}}) (sql.Result, error) {
2020-08-12 09:19:37 +08:00
query := ` + "`" + `insert into ` + "`" + ` + m.table + ` + "`(` + " + `{{.lowerStartCamelObject}}RowsExpectAutoSet` + " + `) value ({{.expression}})` " + `
2020-08-16 23:28:01 +08:00
return m.{{if .withCache}}ExecNoCache{{else}}conn.Exec{{end}}(query, {{.expressionValues}})
2020-07-29 17:11:41 +08:00
}
`