- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 33 for pet2 (0.03 sec)
-
tests/associations_has_many_test.go
pets2 := []Pet{{Name: "pet-has-many-append-1-1"}, {Name: "pet-has-many-append-1-1"}} if err := DB.Model(&user2).Association("Pets").Append(&pets2); err != nil { t.Fatalf("Error happened when append pet, got %v", err) } for _, pet := range pets2 { pet := pet if pet.ID == 0 { t.Fatalf("Pet's ID should be created") } user.Pets = append(user.Pets, &pet) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/create_test.go
}} if err := DB.Create(&pets).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } var petIDs []uint for _, pet := range pets { petIDs = append(petIDs, pet.ID) CheckPet(t, pet, pet) } var pets2 []Pet DB.Preload("Toy").Find(&pets2, "id IN ?", petIDs) for idx, pet := range pets2 { CheckPet(t, pet, pets[idx]) } })
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/preload_test.go
} else { sort.Slice(users2[2].Pets, func(i, j int) bool { return users2[2].Pets[i].ID < users2[2].Pets[j].ID }) for _, pet := range users2[2].Pets[0:2] { if pet.Toy.Name != "" { t.Errorf("No toy should for user %v's pet %v but got %v", 3, pet.Name, pet.Toy.Name) } } CheckPet(t, *users2[2].Pets[2], *users[2].Pets[2]) } } func TestPreloadEmptyData(t *testing.T) {
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/joins_test.go
DB.Joins("inner join pets on pets.user_id = users.id AND pets.name = @Name", user.Pets[0]).Where("users.name = ?", user.Name).First(&users6) if len(users6) != 1 { t.Errorf("should find one users using left join with conditions, but got %v", len(users6)) } dryDB := DB.Session(&gorm.Session{DryRun: true})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:58:13 UTC 2024 - 15K bytes - Viewed (0) -
tests/table_test.go
} r = dryDB.Table("(?) as u, (?) as p", DB.Model(&User{}).Select("name"), DB.Model(&Pet{}).Select("name")).Find(&User{}).Statement if !regexp.MustCompile("SELECT \\* FROM \\(SELECT .name. FROM .users. WHERE .users.\\..deleted_at. IS NULL\\) as u, \\(SELECT .name. FROM .pets. WHERE .pets.\\..deleted_at. IS NULL\\) as p WHERE .u.\\..deleted_at. IS NULL").MatchString(r.Statement.SQL.String()) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Mar 09 09:31:28 UTC 2024 - 10.6K bytes - Viewed (0) -
schema/schema_test.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 20 12:19:31 UTC 2024 - 13.3K bytes - Viewed (0) -
tests/update_test.go
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/associations_test.go
children, parent.Children) } } func TestAssociationError(t *testing.T) { user := *GetUser("TestAssociationError", Config{Pets: 2, Company: true, Account: true, Languages: 2}) DB.Create(&user) var user1 User DB.Preload("Company").Preload("Pets").Preload("Account").Preload("Languages").First(&user1) var emptyUser User var err error // belongs to
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 08 08:29:09 UTC 2023 - 10.9K bytes - Viewed (0) -
tests/upsert_test.go
} DB.Where(&User{Name: "find or create embedded struct"}).Assign(User{Age: 44, Account: Account{Number: "1231231231"}, Pets: []*Pet{{Name: "first_or_create_pet1"}, {Name: "first_or_create_pet2"}}}).FirstOrCreate(&user8) if err := DB.Where("name = ?", "first_or_create_pet1").First(&Pet{}).Error; err != nil { t.Errorf("has many association should be saved") }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Sep 05 07:39:19 UTC 2022 - 11.4K bytes - Viewed (0) -
guava-tests/test/com/google/common/collect/ForwardingMultisetTest.java
}); } public void testEquals() { Multiset<String> set1 = ImmutableMultiset.of("one"); Multiset<String> set2 = ImmutableMultiset.of("two"); new EqualsTester() .addEqualityGroup(set1, wrap(set1), wrap(set1)) .addEqualityGroup(set2, wrap(set2)) .testEquals(); } private static <T> Multiset<T> wrap(final Multiset<T> delegate) { return new ForwardingMultiset<T>() {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 00:05:46 UTC 2024 - 11.8K bytes - Viewed (0)