- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 1,389 for user2 (0.08 sec)
-
tests/joins_test.go
} else if len(users2) != len(users) { t.Fatalf("Failed to load join users, got: %v, expect: %v", len(users2), len(users)) } sort.Slice(users2, func(i, j int) bool { return users2[i].ID > users2[j].ID }) sort.Slice(users, func(i, j int) bool { return users[i].ID > users[j].ID }) for idx, user := range users { // user CheckUser(t, user, users2[idx])
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:58:13 UTC 2024 - 15K bytes - Viewed (0) -
tests/preload_test.go
} var user4 *User DB.Preload("Pets.Toy").Find(&user4, "id = ?", user.ID) if len(user4.Pets) != 0 { t.Fatalf("User.Pet[0] was deleted and should not exist.") } var user5 User DB.Unscoped().Preload(clause.Associations+"."+clause.Associations).Find(&user5, "id = ?", user.ID) CheckUserUnscoped(t, user5, user) var user6 *User DB.Unscoped().Preload("Pets.Toy").Find(&user6, "id = ?", user.ID)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0) -
tests/count_test.go
func TestCount(t *testing.T) { var ( user1 = *GetUser("count-1", Config{}) user2 = *GetUser("count-2", Config{}) user3 = *GetUser("count-3", Config{}) users []User count, count1, count2 int64 ) DB.Save(&user1).Save(&user2).Save(&user3) if err := DB.Where("name = ?", user1.Name).Or("name = ?", user3.Name).Find(&users).Count(&count).Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 6.9K bytes - Viewed (0) -
tests/associations_belongs_to_test.go
t.Errorf("failed to query users, got error %#v", err) } user2.Manager = &User{} DB.Model(&user2).Association("Manager").Find(user2.Manager) CheckUser(t, user2, user) // Count AssertAssociationCount(t, user, "Company", 1, "") AssertAssociationCount(t, user, "Manager", 1, "") // Append company := Company{Name: "company-belongs-to-append"} manager := GetUser("manager-belongs-to-append", Config{})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 9.3K bytes - Viewed (0) -
tests/associations_has_many_test.go
t.Fatalf("errors happened when create: %v", err) } CheckUser(t, user, user) // Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Team").Find(&user2.Team) CheckUser(t, user2, user) // Count AssertAssociationCount(t, user, "Team", 2, "") // Append team := *GetUser("team", Config{})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/update_test.go
if users[1].Name != "update_column_02_newname" || users[1].Age != 100 { t.Errorf("user 2 should be updated with update column") } AssertEqual(t, lastUpdatedAt.UnixNano(), users[1].UpdatedAt.UnixNano()) // user2 should not be updated var user1, user2 User DB.First(&user1, users[0].ID) DB.First(&user2, users[1].ID) CheckUser(t, user1, *users[0]) CheckUser(t, user2, *users[1])
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0) -
tests/associations_has_one_test.go
) func TestHasOneAssociation(t *testing.T) { user := *GetUser("hasone", Config{Account: true}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckUser(t, user, user) // Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Account").Find(&user2.Account) CheckUser(t, user2, user) // Count
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 7.1K bytes - Viewed (0) -
tests/associations_many2many_test.go
func TestMany2ManyAssociation(t *testing.T) { user := *GetUser("many2many", Config{Languages: 2}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckUser(t, user, user) // Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Languages").Find(&user2.Languages) CheckUser(t, user2, user) // Count
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Jun 10 13:05:19 UTC 2023 - 13.2K bytes - Viewed (0) -
tests/sql_builder_test.go
if age != 20 { t.Errorf("Scan with Row, age expects: %v, got %v", user2.Age, age) } } func TestRows(t *testing.T) { user1 := User{Name: "RowsUser1", Age: 1} user2 := User{Name: "RowsUser2", Age: 10} user3 := User{Name: "RowsUser3", Age: 20} DB.Save(&user1).Save(&user2).Save(&user3) rows, err := DB.Table("users").Where("name = ? or name = ?", user2.Name, user3.Name).Select("name, age").Rows() if err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Jan 12 08:42:21 UTC 2024 - 16.7K bytes - Viewed (0) -
tests/create_test.go
DB.Omit(clause.Associations).Create(&user2) var result2 User DB.Preload(clause.Associations).First(&result2, user2.ID) user2.Account = Account{} user2.Toys = nil user2.Manager = nil user2.Company = Company{} user2.Pets = nil user2.Team = nil user2.Languages = nil user2.Friends = nil CheckUser(t, result2, user2) } func TestFirstOrCreateNotExistsTable(t *testing.T) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0)