1
0
Fork 0
mirror of synced 2024-10-03 19:43:32 +13:00

Commenting on a bug in knex

This commit is contained in:
mike12345567 2024-06-19 13:59:03 +01:00
parent bc80841554
commit bdbb4c0a66

View file

@ -621,9 +621,13 @@ class InternalBuilder {
query = this.addSorting(query, json)
}
const alias = tableAliases?.[tableName] || tableName
let preQuery = knex({
[alias]: query,
} as any)
let preQuery: Knex.QueryBuilder = knex({
// the typescript definition for the knex constructor doesn't support this
// syntax, but it is the only way to alias a pre-query result as part of
// a query - there is an alias dictionary type, but it assumes it can only
// be a table name, not a pre-query
[alias]: query as any,
})
if (counting) {
preQuery = preQuery.count("* as total")
} else {