jeremydaly / serverless-mysql

A module for managing MySQL connections at SERVERLESS scale
MIT License
1.2k stars 82 forks source link

How to get a single query result? Not an array. #131

Closed Nhahan closed 1 year ago

Nhahan commented 2 years ago

SELECT * FROM orders WHERE id = ${id} I expected to get a single object result but it returns an array.

How to control whether to receive query results in an array or not?

Thank you for your help.

naorpeled commented 1 year ago

Hey @Nhahan, we don't really deal with the content of the query in the scope of this library, so we can't really differentiate between a single result query and a multiple result query.

For such a thing I'd suggest using some kind of query builder, such as Kysely.

I'll be closing this issue but feel free to ping me if you need anything :)