Skip to content

Commit

Permalink
Merge pull request #1217 from go-gorm/fix_updates_tag_hook
Browse files Browse the repository at this point in the history
fix: Updates method is invalid for tag type hooks
  • Loading branch information
qqxhb authored Oct 16, 2024
2 parents ebb6364 + bf545ef commit d7de699
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 d7de699

Please sign in to comment.