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.
18 lines
960 B
Go
18 lines
960 B
Go
package template
|
|
|
|
var Insert = `
|
|
func (m *default{{.upperStartCamelObject}}Model) Insert(data {{.upperStartCamelObject}}) (sql.Result,error) {
|
|
{{if .withCache}}{{if .containsIndexCache}}{{.keys}}
|
|
ret, err := m.Exec(func(conn sqlx.SqlConn) (result sql.Result, err error) {
|
|
query := fmt.Sprintf("insert into %s (%s) values ({{.expression}})", m.table, {{.lowerStartCamelObject}}RowsExpectAutoSet)
|
|
return conn.Exec(query, {{.expressionValues}})
|
|
}, {{.keyValues}}){{else}}query := fmt.Sprintf("insert into %s (%s) values ({{.expression}})", m.table, {{.lowerStartCamelObject}}RowsExpectAutoSet)
|
|
ret,err:=m.ExecNoCache(query, {{.expressionValues}})
|
|
{{end}}{{else}}query := fmt.Sprintf("insert into %s (%s) values ({{.expression}})", m.table, {{.lowerStartCamelObject}}RowsExpectAutoSet)
|
|
ret,err:=m.conn.Exec(query, {{.expressionValues}}){{end}}
|
|
return ret,err
|
|
}
|
|
`
|
|
|
|
var InsertMethod = `Insert(data {{.upperStartCamelObject}}) (sql.Result,error)`
|