Vex · API
analyze
analyze checks a resolved query (the output of resolve) against the analyzer settings and returns { warnings, errors }. Example: the filter is on show_night, which has no index; with warnUnindexedFilters: true and rejectUnindexedFilters: false it is reported as a warning.
{
from: ['bookings', 'members'],
fields: [
{ field: 'members.name', as: 'name' },
{ field: 'bookings.seats', as: 'seats' },
],
filter: { eq: ['bookings.show_night', { $context: 'night' }] },
sort: [{ field: 'members.name', dir: 'asc' }],
}CREATE TABLE bookings ( id text PRIMARY KEY, show_night text NOT NULL REFERENCES shows(night), member_id text NOT NULL REFERENCES members(id), seats integer NOT NULL )
{
maxNestingDepth: 2,
rejectCartesianProducts: true,
warnUnindexedFilters: true,
rejectUnindexedFilters: false,
}{
warnings: [
'Unindexed filter columns: bookings.show_night. Consider adding indexes for better performance.',
],
errors: [],
}Runs in this page on the installed package. The input and the expected output are defined by the example.