Map/transform selected column
Is it possible to transform a column value when we define the select? This would be super useful for when sharing a subquery as I could cololcate the transform code with it instead of having a seperate transform function. Something like:
4 Replies
Yes you can use partial select and sql operator: https://orm.drizzle.team/docs/select#partial-select
Drizzle ORM - Select
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
i was ideally looking to do this without using
sql and mapWith, i'd prefer to not forfeit the type safety of using thoseI am afraid that’s not possible, except by using the returned value and passing a mapper in the .then/after await.
Feel free to open a feature request or comment on https://github.com/drizzle-team/drizzle-orm/discussions/2316
GitHub
Relational API v2 · drizzle-team drizzle-orm · Discussion #2316
We've launched Drizzle Relational Queries exactly a year ago and it's time to ship a fundamental upgrade. We've gathered a massive amount of valuable feedback from the community and goi...