mariadb-cli 0.1.1

One-shot agent-native command line client for MariaDB servers
Documentation
//! Version history of tables that keep one.

use clap::{Args, Subcommand};

/// The three history commands.
#[derive(Debug, Clone, Subcommand)]
pub enum HistoryCommand {
    /// State of a table at one instant.
    AsOf(AsOfArgs),
    /// Changes over an interval.
    Between(BetweenArgs),
    /// Which tables keep a version history.
    Tables(HistoryTablesArgs),
}

/// Reading a table as it was at one instant.
#[derive(Debug, Clone, Args)]
pub struct AsOfArgs {
    /// Table to read.
    ///
    /// Optional to the argument layer and required to the command. Publishing
    /// the contract must cost nothing, and a caller asking what this command
    /// answers should not have to invent a table first. Absence is refused
    /// where the reading actually happens, and carries a code.
    #[arg(long)]
    pub table: Option<String>,
    /// The instant to read at.
    ///
    /// Optional to the argument layer and required to the command, for the
    /// same reason as the table.
    #[arg(long)]
    pub at: Option<String>,
}

/// Reading the changes over an interval.
#[derive(Debug, Clone, Args)]
pub struct BetweenArgs {
    /// Table to read.
    ///
    /// Optional to the argument layer and required to the command, for the
    /// reason given on [`AsOfArgs::table`].
    #[arg(long)]
    pub table: Option<String>,
    /// Start of the interval.
    ///
    /// Optional to the argument layer and required to the command, for the
    /// same reason as the table.
    #[arg(long)]
    pub from: Option<String>,
    /// End of the interval.
    ///
    /// Optional to the argument layer and required to the command, for the
    /// same reason as the table.
    #[arg(long)]
    pub to: Option<String>,
}

/// Listing the tables that keep a history.
#[derive(Debug, Clone, Args)]
pub struct HistoryTablesArgs {}