feat(plugin): expose a read-only schema metadata host API
This commit is contained in:
1 parent
2f960f104c
commit
d5a05a9884
40 files changed
+1445
-86
No files matched your search
@@ -232,15 +232,12 @@ pub async fn mongo_server_version_core(
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn mongo_run_command_core(
|
||||
state: &AppState,
|
||||
connection_id: &str,
|
||||
pub(crate) async fn mongo_run_command_with_existing_pool(
|
||||
pool: &PoolKind,
|
||||
database: &str,
|
||||
command_json: &str,
|
||||
) -> Result<MongoDocumentResult, String> {
|
||||
ensure_document_pool(state, connection_id).await?;
|
||||
let pool = state.pool_handle(connection_id).await.ok_or("Not found")?;
|
||||
match &pool {
|
||||
match pool {
|
||||
PoolKind::MongoDb(client) => mongo_driver::run_command(client, database, command_json).await,
|
||||
PoolKind::Agent(client) => {
|
||||
let mut client = client.lock().await;
|
||||
@@ -261,6 +258,17 @@ pub async fn mongo_run_command_core(
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn mongo_run_command_core(
|
||||
state: &AppState,
|
||||
connection_id: &str,
|
||||
database: &str,
|
||||
command_json: &str,
|
||||
) -> Result<MongoDocumentResult, String> {
|
||||
ensure_document_pool(state, connection_id).await?;
|
||||
let pool = state.pool_handle(connection_id).await.ok_or("Not found")?;
|
||||
mongo_run_command_with_existing_pool(&pool, database, command_json).await
|
||||
}
|
||||
|
||||
pub async fn mongo_show_databases_core(state: &AppState, connection_id: &str) -> Result<MongoDocumentResult, String> {
|
||||
mongo_run_command_core(state, connection_id, MONGO_SHOW_DATABASES_DATABASE, MONGO_SHOW_DATABASES_COMMAND_JSON).await
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user