mirror of
https://github.com/gogs/gogs.git
synced 2026-02-27 16:50:58 +01:00
- Replace import "xorm.io/xorm" with "gorm.io/gorm"
- Replace all Engine parameters with *gorm.DB
- Replace *xorm.Session parameters with *gorm.DB
- Convert all database queries from XORM to GORM syntax:
- e.ID(id).Get(&model) → db.First(&model, id).Error
- e.Insert(&model) → db.Create(&model).Error
- e.Update(&model) → db.Updates(&model).Error
- e.In("col", values) → db.Where("col IN ?", values)
- e.Find(&results) → db.Find(&results).Error
- e.Iterate() → db.FindInBatches()
- Convert transaction patterns from NewSession/Begin/Commit to db.Transaction()
- Replace global x variable with db
- Convert XORM AfterSet callback to GORM AfterFind hook
- Handle gorm.ErrRecordNotFound for missing records
- Fix related files: repositories.go, repo_collaboration.go, two_factor.go
Co-authored-by: unknwon <2946214+unknwon@users.noreply.github.com>