Ayoub
Ayoub
DTDrizzle Team
Created by Ayoub on 3/28/2024 in #help
Dynamic query columns projection
Hey, i'm trying to do a dynamic selection of columns in my queries, having before hand an array of the wanted columns from the table, its postgres btw
const projection = fieldsProjection(info);
console.log(projection)
const query = db.select().from(drivers);
const projection = fieldsProjection(info);
console.log(projection)
const query = db.select().from(drivers);
the projection array looks for example like this
[ 'id', 'username', 'password', 'email' ]
[ 'id', 'username', 'password', 'email' ]
if someone had to do something similar before, please insight me, tried some of the solutions from github issues but things were messy and didn't work, thought maybe someone found something better in this case
2 replies