Ghost
Ghost
DTDrizzle Team
Created by Ghost on 5/7/2025 in #help
Is using "_" (underscore) safe?
I'm using underscore to get selected fields from subquery. I'm thinking it should be for internals maybe removed future releases? Example:
const sq = this.db.$with('prods_with_qty').as(
this.db
.select({
...getTableColumns(ProductsTable),
qty: SQL_PRODUCT_STOCKS_QTY,
})
.from(ProductsTable),
);
this.db
.with(sq)
.select({
...sq._.selectedFields, // <- here. It's working perfectly fine, but should I do that?
owner: SQL_USER_MINI_RES_COLS,
})
.from(sq)
const sq = this.db.$with('prods_with_qty').as(
this.db
.select({
...getTableColumns(ProductsTable),
qty: SQL_PRODUCT_STOCKS_QTY,
})
.from(ProductsTable),
);
this.db
.with(sq)
.select({
...sq._.selectedFields, // <- here. It's working perfectly fine, but should I do that?
owner: SQL_USER_MINI_RES_COLS,
})
.from(sq)
2 replies