Is there a way to create a chained object from loop? For example input:
["table1","table2","table3"]
output:
db
.select(fields)
.from(table)
.innerJoin("table1")
.innerJoin("table2")
.innerJoin("table3")
another input:
["table1","table2","table3","table4","table5"]
output:
db
.select(fields)
.from(table)
.innerJoin("table1")
.innerJoin("table2")
.innerJoin("table3")
.innerJoin("table4")
.innerJoin("table5")
Right now i have no idea how to do that except using eval, which isn't something i would like to do.
I need this to join multiple tables using knex, so if there any other way to do so, i will be really happy :)