mariadb_cli/cli/history.rs
1//! Version history of tables that keep one.
2
3use clap::{Args, Subcommand};
4
5/// The three history commands.
6#[derive(Debug, Clone, Subcommand)]
7pub enum HistoryCommand {
8 /// State of a table at one instant.
9 AsOf(AsOfArgs),
10 /// Changes over an interval.
11 Between(BetweenArgs),
12 /// Which tables keep a version history.
13 Tables(HistoryTablesArgs),
14}
15
16/// Reading a table as it was at one instant.
17#[derive(Debug, Clone, Args)]
18pub struct AsOfArgs {
19 /// Table to read.
20 ///
21 /// Optional to the argument layer and required to the command. Publishing
22 /// the contract must cost nothing, and a caller asking what this command
23 /// answers should not have to invent a table first. Absence is refused
24 /// where the reading actually happens, and carries a code.
25 #[arg(long)]
26 pub table: Option<String>,
27 /// The instant to read at.
28 ///
29 /// Optional to the argument layer and required to the command, for the
30 /// same reason as the table.
31 #[arg(long)]
32 pub at: Option<String>,
33}
34
35/// Reading the changes over an interval.
36#[derive(Debug, Clone, Args)]
37pub struct BetweenArgs {
38 /// Table to read.
39 ///
40 /// Optional to the argument layer and required to the command, for the
41 /// reason given on [`AsOfArgs::table`].
42 #[arg(long)]
43 pub table: Option<String>,
44 /// Start of the interval.
45 ///
46 /// Optional to the argument layer and required to the command, for the
47 /// same reason as the table.
48 #[arg(long)]
49 pub from: Option<String>,
50 /// End of the interval.
51 ///
52 /// Optional to the argument layer and required to the command, for the
53 /// same reason as the table.
54 #[arg(long)]
55 pub to: Option<String>,
56}
57
58/// Listing the tables that keep a history.
59#[derive(Debug, Clone, Args)]
60pub struct HistoryTablesArgs {}