- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 966 for user2 (0.02 sec)
-
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/update_belongs_to_test.go
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) } var user3 User DB.Preload("Company").Preload("Manager").Find(&user3, "id = ?", user.ID) CheckUser(t, user2, user3)
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_has_many_test.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 2K 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/update_many2many_test.go
} var user3 User DB.Preload("Languages").Preload("Friends").Find(&user3, "id = ?", user.ID) CheckUser(t, user2, user3) if err := DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var user4 User DB.Preload("Languages").Preload("Friends").Find(&user4, "id = ?", user.ID) CheckUser(t, user4, user)
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/update_has_one_test.go
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) if err := DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(&user).Error; err != nil {
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/connpool_test.go
"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?", "SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?", "INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`) VALUES (?,?,?,?,?,?,?,?,?)", "SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
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/prepared_stmt_test.go
} 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 { t.Fatalf("no error should happen but got %v", err) } }
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/delete_test.go
} } for _, user := range []User{users[0], users[2]} { result = User{} if err := DB.Where("id = ?", user.ID).First(&result).Error; err != nil { t.Errorf("no error should returns when query %v, but got %v", user.ID, err) } } if err := DB.Delete(&users[0]).Error; err != nil { t.Errorf("errors happened when delete: %v", err) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Oct 10 07:03:34 UTC 2023 - 9.4K bytes - Viewed (0)