Vex · Query DSL

Parameters ($context)

{ $context: 'night' } is a placeholder for a value the caller supplies with each request. It compiles to a positional parameter ($1) and the value is passed as a bound parameter, so it is never part of the SQL text. One stored query therefore serves any night.

Query
{
  from: ['bookings'],
  fields: ['bookings.id', 'bookings.seats'],
  filter: { eq: ['bookings.show_night', { $context: 'night' }] },
}
Context
{ night: '2026-10-24' }
SQL
SELECT b1.id AS "id", b1.seats AS "seats"
FROM bookings AS b1
WHERE b1.show_night = $1
LIMIT 100
Parameters
[{ key: 'night', kind: 'context', type: 'string' }]
Parameter values
['2026-10-24']
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.