Skip to content

Commit

Permalink
fix: Updates method is invalid for tag type hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
qqxhb committed Sep 23, 2024
1 parent ebb6364 commit bf545ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions do.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (d *DO) ReplaceConnPool(pool gorm.ConnPool) {
// UseModel specify a data model structure as a source for table name
func (d *DO) UseModel(model interface{}) {
d.modelType = d.indirect(model)

d.db = d.db.Model(model).Session(&gorm.Session{})
err := d.db.Statement.Parse(model)
if err != nil {
panic(fmt.Errorf("Cannot parse model: %+v\n%w", model, err))
Expand Down Expand Up @@ -710,7 +710,7 @@ func (d *DO) Updates(value interface{}) (info ResultInfo, err error) {
valTyp = rawTyp
}

tx := d.db
tx := d.db.Model(d.newResultPointer())
if d.backfillData != nil {
tx = tx.Model(d.backfillData)
}
Expand Down

0 comments on commit bf545ef

Please sign in to comment.