- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 17 for Toys (0.4 sec)
-
tests/associations_has_many_test.go
*GetUser("slice-hasmany-2", Config{Toys: 0, Tools: 2}), *GetUser("slice-hasmany-3", Config{Toys: 4}), } DB.Create(&users) // Count AssertAssociationCount(t, users, "Toys", 6, "") AssertAssociationCount(t, users, "Tools", 2, "") // Find var toys []Toy if DB.Model(&users).Association("Toys").Find(&toys); len(toys) != 6 { t.Errorf("toys count should be %v, but got %v", 6, len(toys)) }
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/create_test.go
*GetUser("bulk_5", Config{Account: false, Pets: 0, Toys: 3, Company: true, Manager: false, Team: 1, Languages: 3, Friends: 1}), *GetUser("bulk_6", Config{Account: true, Pets: 4, Toys: 3, Company: false, Manager: true, Team: 1, Languages: 3, Friends: 0}), *GetUser("bulk_7", Config{Account: true, Pets: 1, Toys: 3, Company: true, Manager: true, Team: 4, Languages: 3, Friends: 1}),
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0) -
tests/update_has_many_test.go
t.Fatalf("errors happened when create: %v", err) } user.Toys = []Toy{{Name: "toy1"}, {Name: "toy2"}} if err := DB.Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var user2 User DB.Preload("Toys").Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) for idx := range user.Toys { user.Toys[idx].Name += "new" } if err := DB.Save(&user).Error; err != nil {
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 2K bytes - Viewed (0) -
tests/named_polymorphic_test.go
} if DB.Model(&hamster2).Association("PreferredToy").Count() != 1 { t.Errorf("Hamster's toys count should be 1 after Append") } if DB.Model(&hamster2).Association("OtherToy").Count() != 1 { t.Errorf("Hamster's toys count should be 1 after Append") } // Replace DB.Model(&hamster).Association("PreferredToy").Replace(&Toy{ Name: "bike 3", })
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Wed Jul 08 09:59:40 UTC 2020 - 4.2K bytes - Viewed (0) -
tests/helper_test.go
} } }) t.Run("Toys", func(t *testing.T) { if len(user.Toys) != len(expect.Toys) { t.Fatalf("toys should equal, expect: %v, got %v", len(expect.Toys), len(user.Toys)) } sort.Slice(user.Toys, func(i, j int) bool { return user.Toys[i].ID > user.Toys[j].ID }) sort.Slice(expect.Toys, func(i, j int) bool { return expect.Toys[i].ID > expect.Toys[j].ID })
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 8K bytes - Viewed (0) -
tests/associations_has_one_test.go
} DB.Create(&pets) // Count AssertAssociationCount(t, pets, "Toy", 2, "") // Find var toys []Toy if DB.Model(&pets).Association("Toy").Find(&toys); len(toys) != 2 { t.Errorf("toys count should be %v, but got %v", 3, len(toys)) } // Append DB.Model(&pets).Association("Toy").Append( &Toy{Name: "toy-slice-append-1"}, &Toy{Name: "toy-slice-append-2"},
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 7.1K bytes - Viewed (0) -
utils/tests/models.go
package tests import ( "database/sql" "time" "gorm.io/gorm" ) // User has one `Account` (has one), many `Pets` (has many) and `Toys` (has many - polymorphic) // He works in a Company (belongs to), he has a Manager (belongs to - single-table), and also managed a Team (has many - single-table) // He speaks many languages (many to many) and has many friends (many to many - single-table) // His pet also has one Toy (has one - polymorphic)
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Fri Dec 15 08:36:08 UTC 2023 - 2.1K bytes - Viewed (0) -
tests/update_test.go
result.Languages = append(user.Languages, result.Languages...) result.Toys = append(user.Toys, result.Toys...) sort.Slice(result.Languages, func(i, j int) bool { return strings.Compare(result.Languages[i].Code, result.Languages[j].Code) > 0 }) sort.Slice(result.Toys, func(i, j int) bool { return result.Toys[i].ID < result.Toys[j].ID }) sort.Slice(result2.Languages, func(i, j int) bool {
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0) -
tests/delete_test.go
*GetUser("delete_slice_with_associations1", Config{Account: true, Pets: 4, Toys: 1, Company: true, Manager: true, Team: 1, Languages: 1, Friends: 4}), *GetUser("delete_slice_with_associations2", Config{Account: true, Pets: 3, Toys: 2, Company: true, Manager: true, Team: 2, Languages: 2, Friends: 3}), *GetUser("delete_slice_with_associations3", Config{Account: true, Pets: 2, Toys: 3, Company: true, Manager: true, Team: 3, Languages: 3, Friends: 2}),
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Tue Oct 10 07:03:34 UTC 2023 - 9.4K bytes - Viewed (0) -
schema/relationship_test.go
ID int Cat struct { Name string Toy Toy `gorm:"polymorphic:Owner;"` Toys []Toy `gorm:"polymorphic:Owner;"` } `gorm:"embedded;embeddedPrefix:cat_"` Dog struct { ID int Name string UserID int Toy Toy `gorm:"polymorphic:Owner;"` Toys []Toy `gorm:"polymorphic:Owner;"` } Toys []Toy `gorm:"polymorphic:Owner;"` }
Registered: Wed Jun 12 16:27:09 UTC 2024 - Last Modified: Mon Apr 15 03:20:20 UTC 2024 - 25.5K bytes - Viewed (0)