mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-27 18:30:38 +00:00
feat: supports passing user params into coprocessor (#962)
* feat: make args in coprocessor optional * feat: supports kwargs for coprocessor as params passed by the users * feat: supports params for /run-script * fix: we should rewrite the coprocessor by removing kwargs * fix: remove println * fix: compile error after rebasing * fix: improve http_handler_test * test: http scripts api with user params * refactor: tweak all to_owned
This commit is contained in:
@@ -19,6 +19,7 @@ mod opentsdb;
|
||||
mod prometheus;
|
||||
mod standalone;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -512,9 +513,14 @@ impl ScriptHandler for Instance {
|
||||
}
|
||||
}
|
||||
|
||||
async fn execute_script(&self, schema: &str, script: &str) -> server_error::Result<Output> {
|
||||
async fn execute_script(
|
||||
&self,
|
||||
schema: &str,
|
||||
script: &str,
|
||||
params: HashMap<String, String>,
|
||||
) -> server_error::Result<Output> {
|
||||
if let Some(handler) = &self.script_handler {
|
||||
handler.execute_script(schema, script).await
|
||||
handler.execute_script(schema, script, params).await
|
||||
} else {
|
||||
server_error::NotSupportedSnafu {
|
||||
feat: "Script execution in Frontend",
|
||||
|
||||
Reference in New Issue
Block a user