- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 17 for pet (0.02 sec)
-
tests/helper_test.go
} if config.NamedPet { user.NamedPet = &Pet{Name: name + "_namepet"} } return &user } func CheckPetUnscoped(t *testing.T, pet Pet, expect Pet) { doCheckPet(t, pet, expect, true) } func CheckPet(t *testing.T, pet Pet, expect Pet) { doCheckPet(t, pet, expect, false) } func doCheckPet(t *testing.T, pet Pet, expect Pet, unscoped bool) { if pet.ID != 0 { var newPet Pet
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 8K bytes - Viewed (0) -
tests/test_jsonable_encoder.py
person = Person(name="Foo") pet = Pet(owner=person, name="Firulais") assert jsonable_encoder(pet) == {"name": "Firulais", "owner": {"name": "Foo"}} assert jsonable_encoder(pet, include={"name"}) == {"name": "Firulais"} assert jsonable_encoder(pet, exclude={"owner"}) == {"name": "Firulais"} assert jsonable_encoder(pet, include={}) == {} assert jsonable_encoder(pet, exclude={}) == { "name": "Firulais",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 21:56:59 UTC 2024 - 9K bytes - Viewed (0) -
tests/preload_test.go
for idx, user := range users2[0:2] { for _, pet := range user.Pets { if pet.Toy.Name != "" { t.Errorf("No toy should for user %v's pet %v but got %v", idx+1, pet.Name, pet.Toy.Name) } } } if len(users2[2].Pets) != 3 { t.Errorf("Invalid pet toys found for user 3 got %v", len(users2[2].Pets)) } else { sort.Slice(users2[2].Pets, func(i, j int) bool {
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
if len(results) == 0 { t.Fatalf("no record find") } else if results[0].Pet.UserID == nil || *(results[0].Pet.UserID) != user.ID { t.Fatalf("wrong user id in pet") } else if results[0].Pet.Name != user.Pets[0].Name { t.Fatalf("wrong pet name") } } func TestJoinArgsWithDB(t *testing.T) { user := *GetUser("joins-args-db", Config{Pets: 2}) DB.Save(&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/create_test.go
t.Run("Struct", func(t *testing.T) { pet := Pet{ Name: "PolymorphicHasOne", Toy: Toy{Name: "Toy-PolymorphicHasOne"}, } if err := DB.Create(&pet).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckPet(t, pet, pet) var pet2 Pet DB.Preload("Toy").Find(&pet2, "id = ?", pet.ID) CheckPet(t, pet2, pet) }) t.Run("Slice", func(t *testing.T) {
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_has_many_test.go
user.Pets = append(user.Pets, &pet) CheckUser(t, user2, user) AssertAssociationCount(t, user, "Pets", 3, "AfterAppend") 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 {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/associations_has_one_test.go
func TestPolymorphicHasOneAssociation(t *testing.T) { pet := Pet{Name: "hasone", Toy: Toy{Name: "toy-has-one"}} if err := DB.Create(&pet).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckPet(t, pet, pet) // Find var pet2 Pet DB.Find(&pet2, "id = ?", pet.ID) DB.Model(&pet2).Association("Toy").Find(&pet2.Toy) CheckPet(t, pet2, pet) // 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) -
utils/tests/models.go
// 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) // NamedPet is a reference to a named `Pet` (has one) type User struct { gorm.Model Name string Age uint Birthday *time.Time Account Account Pets []*Pet NamedPet *Pet Toys []Toy `gorm:"polymorphic:Owner"`
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Dec 15 08:36:08 UTC 2023 - 2.1K bytes - Viewed (0) -
tests/table_test.go
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
References: []Reference{{"ID", "User", "UserID", "Account", "", true}}, }, { Name: "Pets", Type: schema.HasMany, Schema: "User", FieldSchema: "Pet", References: []Reference{{"ID", "User", "UserID", "Pet", "", true}}, }, { Name: "Toys", Type: schema.HasMany, Schema: "User", FieldSchema: "Toy", Polymorphic: Polymorphic{ID: "OwnerID", Type: "OwnerType", Value: "users"},
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 20 12:19:31 UTC 2024 - 13.3K bytes - Viewed (0)