UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

20 lines (15 loc) 613 B
async function getUsersWithPosts() { const users = await db.query('SELECT * FROM users'); // N+1 query pattern - scalability issue for (const user of users) { const posts = await db.query('SELECT * FROM posts WHERE user_id = ?', [user.id]); user.posts = posts; } return users; } async function getCommentsForPosts(posts) { // Another N+1 pattern for (const post of posts) { post.comments = await db.query('SELECT * FROM comments WHERE post_id = ?', [post.id]); } }