kysely icon indicating copy to clipboard operation
kysely copied to clipboard

[Feature] Allow window function modification

Open Azarattum opened this issue 2 years ago • 2 comments

Originally discussed in https://github.com/kysely-org/kysely/issues/397#issuecomment-1553177254. This would allow support for the frame spec of SQLite. As suggested by @igalklebanov in https://github.com/kysely-org/kysely/issues/397#issuecomment-1553239805 a new syntax .modifyEnd and .modifyFront could be added to OverBuilder to match SelectQueryBuilder syntax. For example an unbounded window would look something like this:

fn.over(qb => 
  qb
    .partitionBy("group")
    .orderBy("order")
    .modifyEnd(sql`ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING`)
)

Azarattum avatar May 19 '23 08:05 Azarattum

Hey 👋

Thanks!

This is also relevant to MySQL & PostgreSQL, and named "frame clause" in both.

igalklebanov avatar May 19 '23 14:05 igalklebanov