mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Merge branch 'main' into json-extract
This commit is contained in:
commit
4fc1b66225
17 changed files with 949 additions and 1153 deletions
|
@ -1,6 +1,25 @@
|
|||
use crate::ext::ExtFunc;
|
||||
use std::fmt;
|
||||
use std::fmt::Display;
|
||||
use std::fmt::{Debug, Display};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct ExternalFunc {
|
||||
pub name: String,
|
||||
pub func: Box<dyn Fn(&[crate::types::Value]) -> crate::Result<crate::types::OwnedValue>>,
|
||||
}
|
||||
|
||||
impl Debug for ExternalFunc {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.name)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for ExternalFunc {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.name)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "json")]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum JsonFunc {
|
||||
|
@ -257,7 +276,7 @@ impl Display for MathFunc {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug)]
|
||||
pub enum Func {
|
||||
Agg(AggFunc),
|
||||
Scalar(ScalarFunc),
|
||||
|
@ -265,6 +284,7 @@ pub enum Func {
|
|||
#[cfg(feature = "json")]
|
||||
Json(JsonFunc),
|
||||
Extension(ExtFunc),
|
||||
External(Rc<ExternalFunc>),
|
||||
}
|
||||
|
||||
impl Display for Func {
|
||||
|
@ -276,6 +296,7 @@ impl Display for Func {
|
|||
#[cfg(feature = "json")]
|
||||
Self::Json(json_func) => write!(f, "{}", json_func),
|
||||
Self::Extension(ext_func) => write!(f, "{}", ext_func),
|
||||
Self::External(generic_func) => write!(f, "{}", generic_func),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue