#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Category {
Operator(OperatorCategory),
Aggregate(AggregateCategory),
Numeric,
DateTime,
List,
String,
Regexp,
Binary,
Table,
System,
Debug,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OperatorCategory {
Numeric,
Comparison,
Logical,
Struct,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AggregateCategory {
General,
Statistical,
Approximate,
}
impl Category {
pub const GENERAL_PURPOSE_AGGREGATE: Self = Category::Aggregate(AggregateCategory::General);
pub const STATISTICAL_AGGREGATE: Self = Category::Aggregate(AggregateCategory::Statistical);
pub const APPROXIMATE_AGGREGATE: Self = Category::Aggregate(AggregateCategory::Approximate);
pub const NUMERIC_OPERATOR: Self = Category::Operator(OperatorCategory::Numeric);
pub const COMPARISON_OPERATOR: Self = Category::Operator(OperatorCategory::Comparison);
pub const LOGICAL_OPERATOR: Self = Category::Operator(OperatorCategory::Logical);
pub const STRUCT_OPERATOR: Self = Category::Operator(OperatorCategory::Struct);
pub const fn as_str(&self) -> &'static str {
match self {
Self::Operator(OperatorCategory::Numeric) => "numeric_operator",
Self::Operator(OperatorCategory::Comparison) => "comparison_operator",
Self::Operator(OperatorCategory::Logical) => "logical_operator",
Self::Operator(OperatorCategory::Struct) => "struct_operator",
Self::Aggregate(AggregateCategory::General) => "general_purpose_aggregate",
Self::Aggregate(AggregateCategory::Statistical) => "statistical_aggregate",
Self::Aggregate(AggregateCategory::Approximate) => "approximate_aggregate",
Self::Numeric => "numeric",
Self::DateTime => "datetime",
Self::List => "list",
Self::String => "string",
Self::Regexp => "regexp",
Self::Binary => "binary",
Self::Table => "table",
Self::System => "system",
Self::Debug => "debug",
}
}
}
#[derive(Debug, Clone, Copy)]
pub struct Documentation {
pub category: Category,
pub description: &'static str,
pub arguments: &'static [&'static str],
pub example: Option<Example>,
}
#[derive(Debug, Clone, Copy)]
pub struct Example {
pub example: &'static str,
pub output: &'static str,
}