gluesql_core/store/
function.rs

1use {
2    crate::{
3        data::CustomFunction as StructCustomFunction,
4        result::{Error, Result},
5    },
6    async_trait::async_trait,
7};
8
9#[async_trait]
10pub trait CustomFunction {
11    async fn fetch_function<'a>(
12        &'a self,
13        _func_name: &str,
14    ) -> Result<Option<&'a StructCustomFunction>> {
15        Err(Error::StorageMsg(
16            "[Storage] CustomFunction is not supported".to_owned(),
17        ))
18    }
19
20    async fn fetch_all_functions<'a>(&'a self) -> Result<Vec<&'a StructCustomFunction>> {
21        Err(Error::StorageMsg(
22            "[Storage] CustomFunction is not supported".to_owned(),
23        ))
24    }
25}
26
27#[async_trait]
28pub trait CustomFunctionMut {
29    async fn insert_function(&mut self, _func: StructCustomFunction) -> Result<()> {
30        Err(Error::StorageMsg(
31            "[Storage] CustomFunction is not supported".to_owned(),
32        ))
33    }
34
35    async fn delete_function(&mut self, _func_name: &str) -> Result<()> {
36        Err(Error::StorageMsg(
37            "[Storage] CustomFunction is not supported".to_owned(),
38        ))
39    }
40}