Select One UX improvement
I have this
and that's fine and works, and great. but what I really want is to get rid of that second line. I don't want an array back if I know I'm only aiming to get a single record back.
Is there a way to do this? Otherwise, let this be a little UX improvement suggestion and you can ignore it / adopt it as you see fit.
Thanks!
5 Replies
you can use relational queries for that, they provide
findFirst
Relational queries – DrizzleORM
Drizzle ORM | %s
Thanks, I'll check it out, looks like a different mental model and structure to the schema/queries that I'll have to pick up to use it.
I saw these before when searching for
findFirst
but what I'm after isn't semantically a "relationship". I'm getting one from a table of one, no relationship with other entities there.you can use it without any joined relations
it's called relational QB because it allows querying relational data, but that's entirely optional
you can use it just as a higher-level query builder
you are mixing promises with await/async...