diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d17c612..cbbbc514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ - Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737) - fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715) - Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735) +- Fix 4734: do not reset id in Delete function. [4738](https://github.com/beego/beego/pull/4738) ## Fix Sonar diff --git a/client/orm/orm.go b/client/orm/orm.go index 003937d9..a72f07cf 100644 --- a/client/orm/orm.go +++ b/client/orm/orm.go @@ -282,13 +282,7 @@ func (o *ormBase) Delete(md interface{}, cols ...string) (int64, error) { func (o *ormBase) DeleteWithCtx(ctx context.Context, md interface{}, cols ...string) (int64, error) { mi, ind := o.getMiInd(md, true) num, err := o.alias.DbBaser.Delete(ctx, o.db, mi, ind, o.alias.TZ, cols) - if err != nil { - return num, err - } - if num > 0 { - o.setPk(mi, ind, 0) - } - return num, nil + return num, err } // create a models to models queryer