|
| std::expected< RawEntry, TableError > | morph::table::detail::readEntry (FilterEntry const &entry, std::string_view column) |
| | Reads which operator an entry sets.
|
| bool | morph::table::detail::operatorDefined (ColumnKind kind, CompiledFilter::Op op) |
| | Whether a column kind defines an operator.
|
| bool | morph::table::detail::parseOperand (ColumnInfo const &info, Services const &services, std::string_view text, std::size_t slot, CompiledFilter::Entry &entry) |
| | Parses one operand for the column's kind into a slot of entry.
|
| std::expected< CompiledFilter::Entry, TableError > | morph::table::detail::compileEntry (FilterEntry const &entry, ColumnInfo const &info, Services const &services) |
| | Compiles one entry for one column.
|
| std::optional< std::size_t > | morph::table::detail::findColumn (std::span< ColumnInfo const > columns, std::string_view columnId) |
| | The index of the column with id columnId.
|
| TableError | morph::table::detail::unknownColumn (std::string const &columnId) |
| | An UnknownColumn error.
|
| std::expected< void, TableError > | morph::table::detail::compileEntries (std::span< FilterEntry const > entries, ColumnInfo const &info, Services const &services, std::vector< CompiledFilter::Entry > &out) |
| | Compiles entries for one column, appending them to out.
|
| std::expected< CompiledFilter::Column, TableError > | morph::table::detail::compileColumnFilter (std::string const &columnId, ColumnFilter const &filter, std::span< ColumnInfo const > columns, Services const &services) |
| | Compiles the filter on one column.
|
| std::expected< CompiledFilter::Group, TableError > | morph::table::detail::compileGroup (GroupFilter const &group, std::span< ColumnInfo const > columns, Services const &services) |
| | Compiles a group: per column, the entries that apply to it.
|
| std::expected< CompiledFilter, TableError > | morph::table::compileFilter (FilterSpec const &spec, std::span< ColumnInfo const > columns, Services const &services) |
| | Compiles spec against columns.
|
Filter specs as data, compiled once and evaluated column at a time.
A FilterSpec is plain data in the JSON shape of spec 7 ยง6, so a document can hold it, a user can save it and a server can receive it. Compiling it against a table's columns parses every value once for its column's kind; evaluating it narrows a candidate list one column at a time.
Semantics, normative for every client and server:
- the include entries of a column combine by combine (any, the default, or all); a match on an exclude entry rejects the row; columns, and groups, combine with each other by AND;
- a group matches a row when its entries match on any of its columns;
- no operator but isEmpty and notEmpty matches an empty or invalid cell;
- text operators compare through the collator's primary-strength fold unless the entry sets caseSensitive; % and _ are ordinary characters.
See docs/spec/table/engine.md.
Definition in file filter.hpp.
| std::expected< CompiledFilter, TableError > morph::table::compileFilter |
( |
FilterSpec const & | spec, |
|
|
std::span< ColumnInfo const > | columns, |
|
|
Services const & | services ) |
|
inlinenodiscard |
Compiles spec against columns.
In a group, an entry whose operator a column's kind does not define, or whose value does not parse for it, does not apply to that column; it is an error only when it applies to none of the group's columns. A quick-search text therefore searches the text columns of a group that also holds numbers.
- Parameters
-
| spec | The filter. |
| columns | The table's columns. |
| services | The collator (values of text filters are folded with it) and date parser; null members mean their defaults. |
- Returns
- The compiled filter, or the first error, naming its column.
Definition at line 614 of file filter.hpp.