|
| TableError | morph::table::detail::limitError (std::string column, std::string message) |
| | A LimitExceeded error.
|
| bool | morph::table::detail::entryTooLong (FilterEntry const &entry, std::size_t max) |
| | Whether any operand of an entry is longer than max bytes.
|
| bool | morph::table::detail::anyTooLong (std::span< FilterEntry const > entries, std::size_t max) |
| | Whether any of entries has an operand longer than max bytes.
|
| std::optional< TableError > | morph::table::detail::checkColumn (std::string const &columnId, std::span< ColumnInfo const > columns, std::function< bool(std::string_view)> const &mayRead) |
| | Checks that a column exists and the principal may read it.
|
| std::optional< TableError > | morph::table::detail::checkFilters (FilterSpec const &filters, std::span< ColumnInfo const > columns, QueryLimits const &limits, std::function< bool(std::string_view)> const &mayRead) |
| | Checks a filter's columns, entry counts and value lengths.
|
| std::expected< TableQuery, TableError > | morph::table::validate (TableQuery query, std::span< ColumnInfo const > columns, QueryLimits const &limits={}, std::function< bool(std::string_view)> const &mayRead={}) |
| | Checks query against the table's columns and limits.
|
| std::string | morph::table::escapeLikePattern (std::string_view text, char escape='\\') |
| | Escapes %, _ and the escape character for a SQL LIKE pattern, so a database-backed server keeps them ordinary characters as the filter semantics require.
|
| std::expected< PageRows, TableError > | morph::table::apply (DataSource const &source, TableQuery const &query, ApplyOptions const &options={}) |
| | Runs query over source in the calling thread: the reference implementation of server mode.
|
| template<typename T> |
| constexpr ColumnKind | morph::table::detail::kindOf () |
| | The column kind a member type gives.
|
| template<typename T> |
| Cell | morph::table::detail::integerCell (T value) |
| | An integer member as a cell.
|
| template<typename T> |
| Cell | morph::table::detail::writtenCell (T const &value) |
| | A member as the text glaze writes for it: an enum by its glaze name, a JSON string decoded, null as an empty cell.
|
| template<typename T> |
| Cell | morph::table::detail::toCell (T const &value) |
| | A member value as a cell.
|
| template<typename Row> |
| std::vector< CellReader< Row > > | morph::table::detail::cellReaders () |
| | One cell reader per key glaze writes, in key order.
|
| template<typename Row> |
| std::vector< ColumnInfo > | morph::table::detail::reflectedColumns () |
| | One column per key glaze writes, its kind from the value's type.
|
| template<typename Row> |
| std::expected< Page< Row >, TableError > | morph::table::apply (std::vector< Row > const &rows, RowKey< Row > key, TableQuery const &query, ApplyOptions const &options={}, std::map< std::string, ColumnKind, std::less<> > const &kinds={}, std::map< std::string, std::string, std::less<> > const &comparators={}) |
| | Runs query over typed rows and returns the page of rows: what a server's list action returns.
|
TableQuery, Page and table::apply: a table's sort, filter and page as a request body, and the server's reference implementation.
In server mode a list action's body embeds a TableQuery and its reply is a Page<Row>. A server implements the action with table::apply over its own rows, or with a database query that honours the same semantics (spec 7 §5–6). validate applies the limits every server applies to an untrusted query. On the client, PageWindow holds the pages fetched around the visible rows.
See docs/spec/table/engine.md.
Definition in file query.hpp.
| std::expected< TableQuery, TableError > morph::table::validate |
( |
TableQuery | query, |
|
|
std::span< ColumnInfo const > | columns, |
|
|
QueryLimits const & | limits = {}, |
|
|
std::function< bool(std::string_view)> const & | mayRead = {} ) |
|
inlinenodiscard |
Checks query against the table's columns and limits.
Every column named must be one of columns, a closed set, and one the principal may read: a filter on a hidden column is an oracle for its value, so hiding a column is not a security control. page.limit is clamped; every other bound is a refusal.
- Parameters
-
| query | The query, as received. |
| columns | The row schema's columns. |
| limits | The bounds. |
| mayRead | Whether the principal may read a column; empty allows every column. |
- Returns
- The query with its limit clamped, or the first violation.
Definition at line 220 of file query.hpp.