drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
24.77k stars 656 forks source link

[FEATURE]: Simplify column definition for Partial Select #3537

Open mbtools opened 2 weeks ago

mbtools commented 2 weeks ago

Feature hasn't been suggested before.

Describe the enhancement you want to request

drizzle: 0.36.1

The goal is to simplify the selection of fields when doing a partial select:

// current syntax
const result = await db.select({
  id: users.id,
  name: users.name,
}).from(users);

A more intuitive way would be this:

// suggested syntax
const result = await db.select()
  .fields(id, name)
  .from(users);

// or
const result = await db.select()
  .from(users)
  .fields(id, name);