Search code examples
gogo-gorm

GORM Database.First(&tableStruct, id) without deleted_at IS NULL


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?


Solution

  • You can use a raw query

    db.Raw("SELECT * FROM table LIMIT 1").Scan(&variable)