feat(dynamodb): support querying, editing, and exporting

This commit is contained in:
zipg authored and GitHub committed 2026-08-17 03:27:44 +08:00
1 parent 92ab9bb0dc
commit e97c9ab5d7
73 files changed
+4493 -134

No files matched your search

+2
View File
@@ -777,6 +777,8 @@ async fn main() {
.route("/document-store/list-databases", post(routes::document_store::list_databases))
.route("/document-store/list-collections", post(routes::document_store::list_collections))
.route("/document-store/find-documents", post(routes::document_store::find_documents))
.route("/document-store/count-documents", post(routes::document_store::count_documents))
.route("/document-store/dynamodb-describe-table", post(routes::document_store::describe_dynamodb_table))
.route(
"/document-store/elasticsearch-count-documents",
post(routes::document_store::elasticsearch_count_documents),
@@ -67,9 +67,26 @@ pub struct DocumentFindRequest {
pub projection: Option<String>,
pub sort: Option<String>,
pub collation: Option<String>,
pub cursor: Option<String>,
pub execution_id: Option<String>,
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DocumentCountRequest {
pub connection_id: String,
pub collection: String,
pub filter: Option<String>,
pub execution_id: Option<String>,
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DynamoDbDescribeTableRequest {
pub connection_id: String,
pub table: String,
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ElasticsearchCountDocumentsRequest {
@@ -204,12 +221,41 @@ pub async fn find_documents(
req.projection.as_deref(),
req.sort.as_deref(),
req.collation.as_deref(),
req.cursor.as_deref(),
),
)
.await?;
Ok(Json(result))
}
pub async fn count_documents(
State(state): State<Arc<WebState>>,
Json(req): Json<DocumentCountRequest>,
) -> Result<Json<u64>, AppError> {
let result = run_cancellable(
&state,
req.execution_id,
dbx_core::document_ops::count_document_store_documents_core(
&state.app,
&req.connection_id,
&req.collection,
req.filter.as_deref(),
),
)
.await?;
Ok(Json(result))
}
pub async fn describe_dynamodb_table(
State(state): State<Arc<WebState>>,
Json(req): Json<DynamoDbDescribeTableRequest>,
) -> Result<Json<dbx_core::db::dynamodb_driver::DynamoDbTableDescription>, AppError> {
let result = dbx_core::document_ops::describe_dynamodb_table_core(&state.app, &req.connection_id, &req.table)
.await
.map_err(AppError::from)?;
Ok(Json(result))
}
pub async fn elasticsearch_count_documents(
State(state): State<Arc<WebState>>,
Json(req): Json<ElasticsearchCountDocumentsRequest>,
+1
View File
@@ -466,6 +466,7 @@ pub async fn find_documents(
req.projection.as_deref(),
req.sort.as_deref(),
req.collation.as_deref(),
None,
),
)
.await?;