npm.io
0.0.4 • Published 3 years ago

prisma-selections

Licence
MIT
Version
0.0.4
Deps
1
Size
15 kB
Vulns
1
Weekly
0
Stars
1

Prisma Selections

Prisma selections allow you to define "select aliases", so instead of writing:

const user = await prisma.user.findUnique({
  select: {
    id: true,
    fullName: true,
    username: true,
    avatarUrl: true,
    // ...
  }
})

You can write this instead:

const user = await prisma.user.findUnique({
  select: selections.user({
    $profileData: true,
    // ...
  })
})

And fully leverage the powerful intellisense provided by Prisma's TypeScript types!