- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for Chalin (0.14 sec)
-
tests/count_test.go
} DB.Model(&User{}).Where("name = ?", user1.Name).Count(&count1).Or("name in ?", []string{user2.Name, user3.Name}).Count(&count2) if count1 != 1 || count2 != 3 { t.Errorf("multiple count in chain should works") } tx := DB.Model(&User{}).Where("name = ?", user1.Name).Session(&gorm.Session{}) tx.Count(&count1) tx.Or("name in ?", []string{user2.Name, user3.Name}).Count(&count2) if count1 != 1 || count2 != 3 {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Oct 30 09:15:49 GMT 2023 - 6.9K bytes - Viewed (0) -
chainable_api.go
} else { tx.Statement.Omits = columns } return } // Where add conditions // // See the [docs] for details on the various formats that where clauses can take. By default, where clauses chain with AND. // // // Find the first user with name jinzhu // db.Where("name = ?", "jinzhu").First(&user) // // Find the first user with name jinzhu and age 20 // db.Where(&User{Name: "jinzhu", Age: 20}).First(&user)
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Apr 17 03:38:55 GMT 2024 - 14.3K bytes - Viewed (1) -
tests/query_test.go
DB.Create(&address) var result AddressByZipCode DB.First(&result, "00501") AssertEqual(t, result, address) } func TestSearchWithEmptyChain(t *testing.T) { user := User{Name: "search_with_empty_chain", Age: 1} DB.Create(&user) var result User if DB.Where("").Where("").First(&result).Error != nil { t.Errorf("Should not raise any error if searching with empty strings") } result = User{}
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Apr 25 12:22:53 GMT 2024 - 49.8K bytes - Viewed (0)