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?


You can use a raw query

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

Answered By – edkeveked

Answer Checked By – David Goodson (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.