postgrelize / over
Function: over() ​
over(
windowFunction,window?):Over
Defined in: src/expressions/methods.ts:212
postgrelize extensionWindow function call: over(fn('row_number'), { partitionBy: ['userId'], orderBy: [['createdAt', 'DESC']] }). PostgreSQL extension.
Parameters ​
windowFunction ​
Function call, e.g. fn('rank').
window? ​
WindowOptions = {}
Partition and order.
Returns ​
Expression usable in attributes and order.
Example ​
ts
await Post.findAll({
attributes: ['id', [over(fn('row_number'), { partitionBy: ['userId'], orderBy: [['createdAt', 'DESC']] }), 'rank']],
});