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.
ntool-biz/zero/template/1.3.8/model/update.tpl

12 lines
494 B
Smarty

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}}
}