- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for User2 (0.03 sec)
-
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/scan_test.go
t.Fatalf("Scan into struct should work, got %#v, should %#v", res, user3) } DB.Table("users").Select("id, name, age").Where("id = ?", user2.ID).Scan(&res) if res.ID != user2.ID || res.Name != user2.Name || res.Age != int(user2.Age) { t.Fatalf("Scan into struct should work, got %#v, should %#v", res, user2) } DB.Model(&User{Model: gorm.Model{ID: user3.ID}}).Select("id, name, age").Scan(&res)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:57:36 UTC 2024 - 10.9K bytes - Viewed (0) -
tests/transaction_test.go
} if err := tx.SavePoint("save_point2").Error; err != nil { t.Fatalf("Failed to save point, got error %v", err) } user2 := *GetUser("transaction-save-point-2", Config{}) tx.Create(&user2) if err := tx.First(&User{}, "name = ?", user2.Name).Error; err != nil { t.Fatalf("Should find saved record") } if err := tx.Commit().Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Sep 14 12:58:29 UTC 2024 - 12.9K bytes - Viewed (0) -
tests/prepared_stmt_test.go
t.Fatalf("no error should happen but got %v", err) } user2 := *GetUser("prepared_stmt2", Config{}) if err := txCtx.Create(&user2).Error; err == nil { t.Fatalf("should failed to create with timeout context") } if err := tx.Create(&user2).Error; err != nil { t.Fatalf("failed to create, got error %v", err) } var result3 User if err := tx.Find(&result3, user2.ID).Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 22 11:02:05 UTC 2024 - 8.5K bytes - Viewed (0) -
tests/query_test.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 50.4K bytes - Viewed (0)