Document how to use where operator with parent context

Bug #2024311 reported by Sylvan Le Deunff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
YAQL
In Progress
Undecided
Sylvan Le Deunff

Bug Description

Documentation gives example on how to use "where" operator with constants filters (like "1" and "John", in example below)

$.customers.where($.orders.len() >= 1 or name = "John")

In real life applications, users will most likely need to use variables defined from context.
(See: https://bugs.launchpad.net/yaql/+bug/1790115)
I couldn't find how to do this in the documentation, only by reading the code.

I suggest adding the following example in Quickstart (https://opendev.org/openstack/yaql/src/branch/master/README.rst)

let(target_age => $.target_age)->$.users.where($.age=$target_age)

And maybe somewhere else adding a brief description of operation "context pass" (->) which is barely mentioned in the doc and not explained at all.

description: updated
description: updated
description: updated
description: updated
Changed in yaql:
assignee: nobody → Sylvan Le Deunff (sylvanld)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to yaql (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/yaql/+/886338

Changed in yaql:
status: New → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.