- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 21 for User2 (0.07 sec)
-
tests/associations_belongs_to_test.go
} CheckUser(t, user, user) // Find var user2 User DB.Find(&user2, "id = ?", user.ID) pointerOfUser := &user2 if err := DB.Model(&pointerOfUser).Association("Company").Find(&user2.Company); err != nil { 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
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/count_test.go
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_has_many_test.go
} 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{}) if err := DB.Model(&user2).Association("Team").Append(&team); err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/joins_test.go
} // Account should empty DB.Delete(&user1.Account) var user2 User DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user2, user.ID) if user2.NamedPet == nil || user2.Account.ID != 0 { t.Fatalf("joins Account should not empty:%v", user2) } // NamedPet should empty DB.Delete(&user1.NamedPet) var user3 User
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:58:13 UTC 2024 - 15K bytes - Viewed (0) -
tests/associations_has_one_test.go
} 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 AssertAssociationCount(t, user, "Account", 1, "") // Append account := Account{Number: "account-has-one-append"} if err := DB.Model(&user2).Association("Account").Append(&account); err != nil {
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/update_has_many_test.go
} var user2 User DB.Preload("Pets").Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) for _, pet := range user.Pets { pet.Name += "new" } if err := DB.Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var user3 User DB.Preload("Pets").Find(&user3, "id = ?", user.ID) CheckUser(t, user2, user3)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 2K bytes - Viewed (0) -
tests/upsert_test.go
} var user2 User DB.First(&user2, user.ID) user2.Age = 30 time.Sleep(time.Second) if err := DB.Clauses(clause.OnConflict{UpdateAll: true}).Create(&user2).Error; err != nil { t.Fatalf("failed to onconflict create user, got error %v", err) } else { var user3 User DB.First(&user3, user.ID) if user3.UpdatedAt.UnixNano() == user2.UpdatedAt.UnixNano() {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Sep 05 07:39:19 UTC 2022 - 11.4K bytes - Viewed (0) -
tests/update_belongs_to_test.go
user.Manager = &User{Name: "manager-belongs-to-association"} if err := DB.Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var user2 User DB.Preload("Company").Preload("Manager").Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) user.Company.Name += "new" user.Manager.Name += "new" if err := DB.Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jul 14 06:55:54 UTC 2022 - 1.6K bytes - Viewed (0) -
tests/update_many2many_test.go
if err := DB.Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var user2 User DB.Preload("Languages").Preload("Friends").Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) for idx := range user.Friends { user.Friends[idx].Name += "new" } for idx := range user.Languages { user.Languages[idx].Name += "new" }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 1.3K bytes - Viewed (0) -
tests/preload_test.go
Friends: 1, }) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckUser(t, user, user) var user2 User DB.Preload(clause.Associations).Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) user3 := *GetUser("preload_with_associations_new", Config{ Account: true, Pets: 2, Toys: 3, Company: true, Manager: true,
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0)