2 ms·
I use this for sql queries: const user = await db.connect(sql => sql.getUserById(43)) The sql value is a proxy that looks for a file called 'getUserById.sql
by cwp 8y ago
I use this for sql queries:
const user = await db.connect(sql => sql.getUserById(43))
The sql value is a proxy that looks for a file called 'getUserById.sql', reads sql out of it, sends the query to the database, and returns a promise for the result. With caching and some sugar methods, it's a pleasant way to use a database.