mirror of
https://github.com/astaxie/beego.git
synced 2025-07-13 13:41:02 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
56d89cc55c | |||
e048377594 | |||
34334a52be | |||
7cdf96d21a |
@ -702,13 +702,6 @@ func (d *dbBase) Delete(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if num > 0 {
|
if num > 0 {
|
||||||
if mi.fields.pk.auto {
|
|
||||||
if mi.fields.pk.fieldType&IsPositiveIntegerField > 0 {
|
|
||||||
ind.FieldByIndex(mi.fields.pk.fieldIndex).SetUint(0)
|
|
||||||
} else {
|
|
||||||
ind.FieldByIndex(mi.fields.pk.fieldIndex).SetInt(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err := d.deleteRels(q, mi, args, tz)
|
err := d.deleteRels(q, mi, args, tz)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return num, err
|
return num, err
|
||||||
|
@ -242,13 +242,7 @@ func (o *orm) Update(md interface{}, cols ...string) (int64, error) {
|
|||||||
func (o *orm) Delete(md interface{}, cols ...string) (int64, error) {
|
func (o *orm) Delete(md interface{}, cols ...string) (int64, error) {
|
||||||
mi, ind := o.getMiInd(md, true)
|
mi, ind := o.getMiInd(md, true)
|
||||||
num, err := o.alias.DbBaser.Delete(o.db, mi, ind, o.alias.TZ, cols)
|
num, err := o.alias.DbBaser.Delete(o.db, mi, ind, o.alias.TZ, cols)
|
||||||
if err != nil {
|
return num, err
|
||||||
return num, err
|
|
||||||
}
|
|
||||||
if num > 0 {
|
|
||||||
o.setPk(mi, ind, 0)
|
|
||||||
}
|
|
||||||
return num, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a models to models queryer
|
// create a models to models queryer
|
||||||
|
Reference in New Issue
Block a user