Generated client
The generated delegate API, common query patterns, and relation-aware writes.
Generated client
The generated client is the main application-facing API.
Core query surface
findUnique,findFirst,findMany,countcreate,createMany,update,updateMany,upsertdelete,deleteManytransactionaggregateandgroupBy
Common query features
selectandinclude- nested create and update inputs
- compound
WhereUniqueInputselectors distinct,orderBy,skip, andtake- cursor pagination on
findMany(...)andfindFirst(...)
Example
final user = await db.user.create(
data: const UserCreateInput(
email: 'alice@example.com',
posts: PostCreateNestedManyWithoutUserInput(
create: <PostCreateWithoutUserInput>[
PostCreateWithoutUserInput(title: 'First post'),
],
),
),
include: const UserInclude(posts: true),
);
final authors = await db.user.findMany(
where: UserWhereInput(
posts: PostListRelationFilter(
some: PostWhereInput(title: StringFilter(contains: 'First')),
),
),
orderBy: const <UserOrderByInput>[
UserOrderByInput(email: SortOrder.asc),
],
);Runtime behavior notes
- the generated layer targets semantic parity first
- PostgreSQL and SQLite own the main SQL-native fast paths for bulk writes, upsert, and cursor pushdown
- middleware works by wrapping the adapter, not by changing generated code
Detailed guides
- CRUD for write and read operations
- Filtering and sorting for
WhereInput,orderBy, and pagination - Relations and includes for nested writes and read shaping
- Aggregations for
aggregate()andgroupBy() - Transactions for multi-step writes
- Testing for in-memory and generated-runtime test patterns