Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,027 for pets (0.02 sec)

  1. tests/association_generics_test.go

    		t.Fatalf("load u2: %v", err)
    	}
    	if len(got1.Pets) != 1 || got1.Pets[0].Name != "x" {
    		t.Fatalf("u1 pet not updated: %+v", got1.Pets)
    	}
    	if len(got2.Pets) != 1 || got2.Pets[0].Name != "x" {
    		t.Fatalf("u2 pet not updated: %+v", got2.Pets)
    	}
    
    	del := clause.Association{Association: "Pets", Type: clause.OpDelete}
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Sep 12 05:42:26 UTC 2025
    - 37.9K bytes
    - Viewed (0)
  2. 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 Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Sep 12 04:33:27 UTC 2025
    - 16.3K bytes
    - Viewed (0)
  3. 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 Dec 28 09:35:17 UTC 2025
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  4. tests/helper_test.go

    			}
    		}
    	})
    
    	t.Run("Pets", func(t *testing.T) {
    		if len(user.Pets) != len(expect.Pets) {
    			t.Fatalf("pets should equal, expect: %v, got %v", len(expect.Pets), len(user.Pets))
    		}
    
    		sort.Slice(user.Pets, func(i, j int) bool {
    			return user.Pets[i].ID > user.Pets[j].ID
    		})
    
    		sort.Slice(expect.Pets, func(i, j int) bool {
    			return expect.Pets[i].ID > expect.Pets[j].ID
    		})
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Tue Mar 19 03:50:28 UTC 2024
    - 8K bytes
    - Viewed (0)
  5. tests/test_response_model_data_filter_no_inheritance.py

    async def create_user(user: UserCreate):
        return user
    
    
    @app.get("/pets/{pet_id}", response_model=PetOut)
    async def read_pet(pet_id: int):
        user = UserDB(
            email="******@****.***",
            hashed_password="secrethashed",
        )
        pet = PetDB(name="Nibbler", owner=user)
        return pet
    
    
    @app.get("/pets/", response_model=list[PetOut])
    async def read_pets():
        user = UserDB(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  6. 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 Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Jul 21 09:55:20 UTC 2025
    - 26.8K bytes
    - Viewed (0)
  7. 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 Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun May 25 07:40:40 UTC 2025
    - 15K bytes
    - Viewed (0)
  8. tests/test_response_model_data_filter.py

    async def create_user(user: UserCreate):
        return user
    
    
    @app.get("/pets/{pet_id}", response_model=PetOut)
    async def read_pet(pet_id: int):
        user = UserDB(
            email="******@****.***",
            hashed_password="secrethashed",
        )
        pet = PetDB(name="Nibbler", owner=user)
        return pet
    
    
    @app.get("/pets/", response_model=list[PetOut])
    async def read_pets():
        user = UserDB(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  9. 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 Dec 28 09:35:17 UTC 2025
    - Last Modified: Wed Jun 12 10:00:47 UTC 2024
    - 15.9K bytes
    - Viewed (0)
  10. tests/generics_test.go

    			}
    		} else if len(result.Pets) != 5 {
    			t.Fatalf("Preload user %v pets should be 5, but got %+v", result.Name, result.Pets)
    		}
    		for i := 1; i < len(result.Pets); i++ {
    			if result.Pets[i-1].Name < result.Pets[i].Name {
    				t.Fatalf("Preload user %v pets not ordered correctly, last %v, cur %v", result.Name, result.Pets[i-1], result.Pets[i])
    			}
    		}
    	}
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun Nov 02 14:09:18 UTC 2025
    - 33.7K bytes
    - Viewed (0)
Back to top