bitemyapp / bitemyapp/esqueleto

`lag` and `lead` function support

Open
#390 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
399
Forks
107
Avg merge
1d 17h
Merged PRs (30d)
1

Description

I want to do a select as the following:

```sql
SELECT
LAG(a.id, 1) OVER (
ORDER BY a.sent_at DESC
) previous_a,
lead(a.id, 1) OVER (
ORDER BY a.sent_at DESC
) next_a
FROM
...
```

Since `esqueleto` doesn't have lag and lead yet, I want to create it using raw sql, but I believe using `unsafeSqlFuntion` doesn't work due to having `over` clause.

Hope someone could point me to the right direction.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining the existing unsafeSqlFuntion entry point and how Esqueleto represents SQL expressions and OVER clauses. Determine the API needed to express LAG and LEAD with ordering, then verify that the example query can be represented and tested; the issue provides no file or test path to begin from.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.