Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groq query stops to support parameters in slicing expression #55

Open
Vladimirb87 opened this issue May 23, 2022 · 2 comments
Open

Groq query stops to support parameters in slicing expression #55

Vladimirb87 opened this issue May 23, 2022 · 2 comments

Comments

@Vladimirb87
Copy link

Description
Starting from 0.3.0 version groq-js doesn't support

To Reproduce
Make query:
evaluate(parse('*[$start..$end]'), { dataset: [], params: { start: 0, end: 1 } })

Expected behavior
The result should be the same as for:
evaluate(parse('*[0..1]'), { dataset: [] })

Actual behavior
GroqQueryError: slicing must use constant numbers

GroqJS version:
0.3.0 oor highere

Problem is not reproducible with groq-js version 0.2.0.

@judofyr
Copy link
Collaborator

judofyr commented May 23, 2022

You'll have to pass the same parameters to parse for this to work:

const params = { start: 0, end: 1 }
evaluate(parse('*[$start..$end]', { params }), { dataset: [], params })

@Vladimirb87
Copy link
Author

Thank you. It works. Would be good to highlight this in docs through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants