- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 21 for User2 (0.05 sec)
-
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) -
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/update_has_one_test.go
} var user2 User DB.Preload("Account").Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) user.Account.Number += "new" if err := DB.Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var user3 User DB.Preload("Account").Find(&user3, "id = ?", user.ID) CheckUser(t, user2, user3) lastUpdatedAt := user2.Account.UpdatedAt time.Sleep(time.Second)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jul 14 06:55:54 UTC 2022 - 3.6K 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/connpool_test.go
t.Fatalf("Should not find record after rollback, but got %v", err) } txDB := db.Where("fake_name = ?", "fake_name") tx2 := txDB.Session(&gorm.Session{NewDB: true}).Begin() user2 := *GetUser("transaction-2", Config{}) if err = tx2.Save(&user2).Error; err != nil { t.Fatalf("No error should raise, but got %v", err) } if err = tx2.First(&User{}, "name = ?", "transaction-2").Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Feb 06 02:54:40 UTC 2024 - 5.5K bytes - Viewed (0) -
tests/delete_test.go
t.Errorf("should raise record not found error, but got error %v", err) } } func TestInlineCondDelete(t *testing.T) { user1 := *GetUser("inline_delete_1", Config{}) user2 := *GetUser("inline_delete_2", Config{}) DB.Save(&user1).Save(&user2) if DB.Delete(&User{}, user1.ID).Error != nil { t.Errorf("No error should happen when delete a record")
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Oct 10 07:03:34 UTC 2023 - 9.4K bytes - Viewed (0)