MCPcopy
hub / github.com/go-gorm/gorm / TestDeletedAtOneOr

Function TestDeletedAtOneOr

tests/soft_delete_test.go:93–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestDeletedAtOneOr(t *testing.T) {
94 actualSQL := DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
95 return tx.Or("id = ?", 1).Find(&User{})
96 })
97
98 if !regexp.MustCompile(` WHERE id = 1 AND .users.\..deleted_at. IS NULL`).MatchString(actualSQL) {
99 t.Fatalf("invalid sql generated, got %v", actualSQL)
100 }
101}
102
103func TestSoftDeleteZeroValue(t *testing.T) {
104 type SoftDeleteBook struct {

Callers

nothing calls this directly

Calls 3

ToSQLMethod · 0.80
FindMethod · 0.65
OrMethod · 0.65

Tested by

no test coverage detected