When tableStruct
have gorm.Model
inside, how to get first record by id
without gorm automatically adding deleted_at IS NULL
? Is there such function?
You can use a raw query
db.Raw("SELECT * FROM table LIMIT 1").Scan(&variable)
After reading the source code, there are Unscoped
method to prevent adding deleted_at IS NULL
Database.Unscoped().First(&tableStruct, id)