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.
12 lines
494 B
Smarty
12 lines
494 B
Smarty
2 years ago
|
|
||
|
func (m *default{{.upperStartCamelObject}}Model) Update(ctx context.Context, tx *gorm.DB, data *{{.upperStartCamelObject}}) error {
|
||
|
{{if .withCache}}{{.keys}}
|
||
|
return m.ExecCtx(ctx, func(conn *gorm.DB) error {
|
||
|
result := gormx.WithTx(ctx, conn, tx).Save(data)
|
||
|
return gormx.WrapUpdateErr(result.Error, result.RowsAffected)
|
||
|
}, {{.keyValues}}){{else}}
|
||
|
result := gormx.WithTx(ctx, m.DB, tx).Save(data)
|
||
|
return gormx.WrapUpdateErr(result.Error, result.RowsAffected)
|
||
|
{{end}}
|
||
|
}
|