#![allow(clippy::upper_case_acronyms)]
#[cfg(feature = "typed-args")]
use chrono::NaiveDate;
use crate::types::TypedValue;
#[derive(Debug, Clone, PartialEq)]
pub enum ArgValue {
Table(Vec<Vec<TypedValue>>), Number(f64),
String(String),
Bool(bool),
Null,
#[cfg(feature = "typed-args")]
Date(NaiveDate),
}
impl core::fmt::Display for ArgValue {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
ArgValue::Table(_) => write!(f, "[Table]"),
ArgValue::Number(n) => write!(f, "{}", n),
ArgValue::String(s) => write!(f, "{}", s),
ArgValue::Bool(b) => write!(f, "{}", b),
ArgValue::Null => write!(f, "null"),
#[cfg(feature = "typed-args")]
ArgValue::Date(d) => write!(f, "{}", d),
}
}
}
impl ArgValue {
pub fn as_number(&self) -> Option<f64> {
match self {
ArgValue::Number(n) => Some(*n),
_ => None,
}
}
}