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
436 stars 29 forks source link

[VOTE] Prisma client APIs #277

Closed medz closed 7 months ago

medz commented 8 months ago

Styles

Style 1

final users = await prisma.user.findMany(
  include: UserInclude(
    posts: UserInclude.posts(
      where: PostWhereInput(
        published: PostWhereInput.published.equals(true),
      ),
    ),
  ),
  where: UserWhereInput(
    name: UserWhereInput.name.$in.ref(UserScalar.tags),
  ),
);

Style 2

final users = await prisma.user.findMany()
  .where(
    UserWhereInput.name.$in.ref(UserScalar.tags),
  )
  .include(UserInclude.posts.where(
    PostWhereInput.published.equals(true),
  ));

Vote

The effect achieved by Style 1 and Style 2 is the same.

eletrofocus commented 8 months ago

Style 2 - 🎉 . Achei menos verboso.

Andregrps commented 8 months ago

Style 2 - Remember the wonderful entity framework