Pass FuncCtx to Insn::Function to keep track of arg count

This commit is contained in:
jussisaurio
2024-09-14 10:31:42 +03:00
parent f67b915855
commit 0839211a49
5 changed files with 220 additions and 235 deletions

View File

@@ -104,6 +104,22 @@ pub enum Func {
Json(JsonFunc),
}
impl Func {
pub fn to_string(&self) -> String {
match self {
Func::Agg(agg_func) => agg_func.to_string().to_string(),
Func::Scalar(scalar_func) => scalar_func.to_string(),
Func::Json(json_func) => json_func.to_string(),
}
}
}
#[derive(Debug)]
pub struct FuncCtx {
pub func: Func,
pub arg_count: usize,
}
impl Func {
pub fn resolve_function(name: &str, arg_count: usize) -> Result<Func, ()> {
match name {