I'm running in to an issue I'll detail with a brief example:

// Example model
type Example struct {
    gorm.Model
    Value bool
}

examples := []Example{}

// Expect to get all examples where Value = true (WORKS AS EXPECTED)
gorm.Where(&Example{Value: true}).Find(&examples)

// Example of SQL executed
SELECT * FROM `examples` WHERE `examples`.`value` = true AND `examples`.`deleted_at` IS NULL

// Expect to get all examples where Value = false (DOESN'T WORK)
gorm.Where(&Example{Value: false}).Find(&examples)

// Example of SQL executed
SELECT * FROM `examples` WHERE `examples`.`deleted_at` IS NULL

I have no idea why using where in this way works only when value is set true.

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: a631807682

In go, &Example{Value: false} is the same as &Example{}, we cannot distinguish, zero value will not be regarded as a condition.