Closed puckey closed 3 years ago
Right: this is what I meant in #80 when I said:
(Though you do need to specify the other columns if you don't want to also return all columns under their original names, as well as your renamed ones).
(I added that note in an edit, so you may not have seen it).
To get what you expected, give it an empty columns
option instead:
const places = await db
.select('place', db.all, {
columns: [],
extras: {
abc: 'id'
}
})
.run(pool); // returns [{"abc":1}]
Ahh understood! Sorry about that : )
I was refactoring my code to use the new
extras
functionality as described in https://github.com/jawj/zapatos/issues/80 and noticed that it was returning both the original column name as well as the aliased one:returns
while I expected it to return
I am not sure this functionality offers any upsides this way, since any use case that I can imagine would then mean mapping through the results to copy over just the
abc
property