- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 16 for User2 (0.03 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/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) -
tests/create_test.go
CheckUser(t, result, user) user2 := *GetUser("omit_create", Config{Account: true, Pets: 3, Toys: 3, Company: true, Manager: true, Team: 3, Languages: 3, Friends: 4}) 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
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0) -
tests/associations_many2many_test.go
} CheckUser(t, user, user) // Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Friends").Find(&user2.Friends) CheckUser(t, user2, user) // Count AssertAssociationCount(t, user, "Friends", 2, "") // Append friend := *GetUser("friend", Config{}) if err := DB.Model(&user2).Association("Friends").Append(&friend); err != nil {
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/update_test.go
DB.First(&result, user.ID) user2 := *GetUser("select_update_new", Config{Account: true, Pets: 3, Toys: 3, Company: true, Manager: true, Team: 3, Languages: 3, Friends: 4}) result.Name = user2.Name result.Age = 50 result.Account = user2.Account result.Pets = user2.Pets result.Toys = user2.Toys result.Company = user2.Company result.Manager = user2.Manager result.Team = user2.Team result.Languages = user2.Languages
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0)