3 ms·
IMHO if you are using a scripted language, I find it easier to NOT use an ORM/ODM layer. function lookupFoo(baz) { const sql = await db.init();
by tracker1 8y ago
IMHO if you are using a scripted language, I find it easier to NOT use an ORM/ODM layer.
function lookupFoo(baz) {
const sql = await db.init();
const result = await sql.query`
SELECT x, y, z
FROM foo
WHERE bar = ${baz}
`;
return result.records.map(mapResultsToFoo)[0];
}
- vkou 8y agoI really hope that sql.query does proper escaping, because otherwise, you're going to have a jolly time, when Bobby Drop Tables signs up for your service.