Comment Comment by saas_co_de > const selectBy = (table, column, value) => db.query(`SELECT * FROM :table WHERE :column = :value`, {table, column, value})> const selectOneBy = (table, column, value) => { const res = selectBy(table, column, value); return res && res.shift() }Two or three lines gives you about 80% of the value in any ORM and avoids the -20% value found in the other 100k LOC. parent saas_co_de 8 years ago
> const selectOneBy = (table, column, value) => { const res = selectBy(table, column, value); return res && res.shift() }
Two or three lines gives you about 80% of the value in any ORM and avoids the -20% value found in the other 100k LOC.