mariadb-cli 0.1.1

One-shot agent-native command line client for MariaDB servers
Documentation
//! The field names and descriptions, one entry per described command.
//!
//! # Why the table is not in the file that reads it
//!
//! Everything in the parent module is mechanism: how a description is looked
//! up, what a conditional field means, what is answered for a command nobody
//! has described yet. None of it changes when a command is described; all of it
//! would have to be scrolled past to reach the thing that does.
//!
//! So the data sits here and the mechanism sits there. It is the same cut that
//! moved the payload out of `contract.rs` one step earlier, made again for the
//! same reason: the part that grows every time a command is described was
//! sharing a file with the part that does not grow at all.

//! The top-level fields of `data`, for the commands whose answer is published.
//!
//! FR-053 promises outputs, and this is the promise that was still being kept
//! by a declared limit rather than by a description. The limit was honest, but
//! it left a caller who wants to validate an answer before consuming it with
//! only one route: run the command once and read what came back.
//!
//! What made the limit necessary is that `data` has no source. Inputs are read
//! from the parser, failures from [`crate::error::Category::ALL`], and both
//! therefore cannot fall behind. A payload built with `json!` inside the
//! command that serves it is described by nothing, so a table written here
//! would be a second copy of a decision made elsewhere — and a second copy is
//! what rots.
//!
//! So this table is not trusted on its own. A proof runs each command named
//! here and refuses any difference between the field names below and the field
//! names the answer actually carries, in both directions: a field published and
//! not emitted fails, and a field emitted and not published fails as well. That
//! is what makes a hand-written table safe to publish, and it is the reason the
//! table covers the commands a proof can run without reaching a server rather
//! than all sixty-three at once.
//!
//! A command absent from this table is not silently undescribed: it publishes
//! the limit for itself, in its own contract, where a caller reads it.

/// The published fields of one command, as pairs of name and description.
pub(super) type Fields = &'static [(&'static str, &'static str)];

/// How this server treats the case of an object name, described once.
///
/// Ten listings carry this field and each would otherwise carry its own copy of
/// the sentence. One copy is one thing to keep true, and the field means exactly
/// the same in all ten because it is the same server setting each time.
const NAME_CASE: &str =
    "string, how this server treats upper and lower case in an object name, which decides \
     whether two names that differ only in case are the same object";

mod local;
mod reaching;

/// Every described command, whichever half of the surface it belongs to.
///
/// A function rather than one constant, because the two halves are two arrays
/// and joining them at compile time would cost more than reading them in turn.
pub(super) fn all() -> impl Iterator<Item = &'static (&'static str, Fields)> {
    local::SHAPES.iter().chain(reaching::SHAPES.iter())
}