Avoid Where phrase with gorm

Issue

I’m trying to update every record in a table:

sqlDB.Table("task").Where("1=1").Update("status", 1)

And I can’t avoid the 1=1 where condition. Is that the right way to do it?

Solution

Yes. 1=1 is a widely recognized always-true WHERE clause. Go for it.

Answered By – O. Jones

Answer Checked By – Mildred Charles (GoLangFix Admin)

Leave a Reply

Your email address will not be published.