When executing queries with this library like so:
db.query('select * from users').then(res => res.rows[0]);
I very often just want to get the first row from the result, and it's tedious to retype the .then(res => res.rows[0]) every time.
It would be great to add some convenience methods like firstRow() or allRows() that would save a lot of typing. For example:
db.query('select * from users').firstRow()
db.query('select * from users').allRows()
db.query('select * from users')
Omitting the methods would maintain the current functionality.
Let me know if you think this is a worthwhile addition.
When executing queries with this library like so:
db.query('select * from users').then(res => res.rows[0]);I very often just want to get the first row from the result, and it's tedious to retype the
.then(res => res.rows[0])every time.It would be great to add some convenience methods like firstRow() or allRows() that would save a lot of typing. For example:
db.query('select * from users').firstRow()db.query('select * from users').allRows()db.query('select * from users')Omitting the methods would maintain the current functionality.
Let me know if you think this is a worthwhile addition.