groq-js
groq-js copied to clipboard
Groq query stops to support parameters in slicing expression
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.
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 })
Thank you. It works. Would be good to highlight this in docs through.