Implement like function

This commit is contained in:
Bennett Clement 2024-07-16 15:20:45 +08:00
parent 7fa8f5c62e
commit 2f738e0c8b
7 changed files with 116 additions and 1 deletions

View file

@ -27,8 +27,19 @@ impl AggFunc {
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum SingleRowFunc {
Coalesce,
Like,
}
impl ToString for SingleRowFunc {
fn to_string(&self) -> String {
match self {
SingleRowFunc::Coalesce => "coalesce".to_string(),
SingleRowFunc::Like => "like(2)".to_string(),
}
}
}
pub enum Func {
@ -50,6 +61,7 @@ impl FromStr for Func {
"sum" => Ok(Func::Agg(AggFunc::Sum)),
"total" => Ok(Func::Agg(AggFunc::Total)),
"coalesce" => Ok(Func::SingleRow(SingleRowFunc::Coalesce)),
"like" => Ok(Func::SingleRow(SingleRowFunc::Like)),
_ => Err(()),
}
}