Subset Overview
Flexible Retrieval
Data formats for each situation A, P, SS, etc.
Type Safety
Compile-time validation Automatic type inference
Relation Loading
Integrated JOIN and Loader 1:N, N:M support
Performance Optimization
Select only needed fields Solve N+1 problem
Why Subsets are Needed
Problem: Limitations of Single Queries
Each API requires different data formats:Solution: Unify with Subsets
Subset Components
1. SubsetQuery - Base Query
Field selection defined in Entity:2. LoaderQuery - Relation Loading
Loading 1:N, N:M relation data:3. Hydrate - Result Transformation
Flat data → Nested object:Subset Naming Conventions
Common Subset name patterns:Subset names can be freely defined. Use consistent conventions within your team.
Practical Examples
User List API
User Profile API
Subset vs Raw Puri
Using Subset (Recommended)
Using Raw Puri
Next Steps
Defining Subsets
Create Subsets in Entity
Using Subsets
Use Subsets in Model
Nested Relations
Load 1:N, N:M with LoaderQuery
Puri Basics
Learn Puri query builder