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.
10 lines
689 B
Smarty
10 lines
689 B
Smarty
3 years ago
|
func (m *default{{.upperStartCamelObject}}Model) Insert(ctx context.Context, data *{{.upperStartCamelObject}}) (sql.Result,error) {
|
||
3 years ago
|
{{if .withCache}}{{.keys}}
|
||
3 years ago
|
ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
|
||
4 years ago
|
query := fmt.Sprintf("insert into %s (%s) values ({{.expression}})", m.table, {{.lowerStartCamelObject}}RowsExpectAutoSet)
|
||
3 years ago
|
return conn.ExecCtx(ctx, query, {{.expressionValues}})
|
||
4 years ago
|
}, {{.keyValues}}){{else}}query := fmt.Sprintf("insert into %s (%s) values ({{.expression}})", m.table, {{.lowerStartCamelObject}}RowsExpectAutoSet)
|
||
3 years ago
|
ret,err:=m.conn.ExecCtx(ctx, query, {{.expressionValues}}){{end}}
|
||
4 years ago
|
return ret,err
|
||
4 years ago
|
}
|