Support custom queries
This might be tricky and ugly. Ideally, it should work together with one of the other methods, so there's no need to think about it.
For example:
let sqlQuery = `select *
from (
select
row_number() over (partition by "${partitionName}" order by "createdAt" DESC) as r,
ds.*
from
${tableName} ds
) x
where x.r <= ${params.limit}`
sqlQuery += ` and "${partitionName}" in (${idsString})`
Source CM: packages/backend-database-module/src/database.service.ts