medz / prisma-dart

Prisma Client Dart is an auto-generated type-safe ORM. It uses Prisma Engine as the data access layer and is as consistent as possible with the Prisma Client JS/TS APIs.
https://prisma.pub
BSD 3-Clause "New" or "Revised" License
450 stars 30 forks source link

[v4] Better `select` and `include` support #297

Closed medz closed 8 months ago

medz commented 10 months ago

当前,只支持粗糙的 selectinlucde,只能在顶层进行数据选择,例如:

UserInclude(
  id: true,
  posts: true
);

// -> {"id": 1, posts: [{id: 1, title: hello}, ...]}

而实际情况是,我们需要更细致的字段选择或者 include:


UserSelect(
    id: true
    posts: PostFindManyArgs(
        select: PostSelect(title: true)
    )
);

// -> {id: 1, posts: [{title: Hello}, ...]}