Skip to content

[FEATURE]: omitApi like Prisma (be able to exclude/omit fields from queries in drizzle) #4280

@fgcoelho

Description

@fgcoelho

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Here's how this works with prisma:

const prisma = new PrismaClient({
  omit: {
    user: {
      password: true
    }
  }
})

// The password field is excluded in all queries, including this one
const user = await prisma.user.findUnique({ where: { id: 1 } })

link to prisma docs

Excluding fields globally is a thing that we can take advantage of, since we already are in an ORM context.

Actually, this was a pull request that took years to be released in the prisma project, I wonder what is possible here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrqbrelational queries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions