3 ms·
Why can't you just build a special GraphQL query with the SQL query you want? I mean having something like query { myCustomQuery(...params...) {
by emteycz 5y ago
Why can't you just build a special GraphQL query with the SQL query you want? I mean having something like
query {
myCustomQuery(...params...) {
id
whatever
}
}
backed by
async function resolver(ctx) {
const rows = await db.query(sql`SELECT yadda as id, badda as whatever FROM dabba JOIN dada ON ...`);
return rows;
}
- Exuma 5y agoWell if that is possible, that's great, but when I've asked similar questions before the answer is always to use some external library like joinmonster or whatever.
- emteycz 5y agoThis is easily possible with the low-level graphql NPM package which is the base of many frameworks. Most give you an option to get through the abstraction and do it.
- szundi 5y agoHow refreshing to see something else than foo and bar