form catalog

This commit is contained in:
Priec
2026-08-12 16:19:41 +02:00
parent 78e3f1ae08
commit bd76efeaac
5 changed files with 112 additions and 2 deletions

2
client

Submodule client updated: c617cd362d...819a4b6300

View File

@@ -27,6 +27,10 @@ service TableDefinition {
// This provides a tree-like overview of table relationships.
rpc GetProfileTree(komp_ac.common.Empty) returns (ProfileTreeResponse);
// Lists the tables visible in one data-entry scope. When profile_name is
// absent, only global tables are returned.
rpc GetTableCatalog(GetTableCatalogRequest) returns (GetTableCatalogResponse);
// Lists every column type a table may declare, along with the SQL type it
// maps to. Pure data retrieval - no business logic.
rpc ListColumnTypes(komp_ac.common.Empty) returns (ListColumnTypesResponse);
@@ -260,6 +264,15 @@ message ProfileTreeResponse {
repeated Profile profiles = 1;
}
message GetTableCatalogRequest {
// Selected profile. Omit this field to request the global-only scope.
optional string profile_name = 1;
}
message GetTableCatalogResponse {
repeated ProfileTreeResponse.Table tables = 1;
}
// Request to fetch all tables, columns and scripts for a profile.
message GetProfileDetailsRequest {
// Profile (schema) name to fetch details for.

Binary file not shown.

View File

@@ -234,6 +234,17 @@ pub mod profile_tree_response {
pub tables: ::prost::alloc::vec::Vec<Table>,
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableCatalogRequest {
/// Selected profile. Omit this field to request the global-only scope.
#[prost(string, optional, tag = "1")]
pub profile_name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTableCatalogResponse {
#[prost(message, repeated, tag = "1")]
pub tables: ::prost::alloc::vec::Vec<profile_tree_response::Table>,
}
/// Request to fetch all tables, columns and scripts for a profile.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetProfileDetailsRequest {
@@ -750,6 +761,37 @@ pub mod table_definition_client {
);
self.inner.unary(req, path, codec).await
}
/// Lists the tables visible in one data-entry scope. When profile_name is
/// absent, only global tables are returned.
pub async fn get_table_catalog(
&mut self,
request: impl tonic::IntoRequest<super::GetTableCatalogRequest>,
) -> std::result::Result<
tonic::Response<super::GetTableCatalogResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/GetTableCatalog",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"GetTableCatalog",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists every column type a table may declare, along with the SQL type it
/// maps to. Pure data retrieval - no business logic.
pub async fn list_column_types(
@@ -985,6 +1027,15 @@ pub mod table_definition_server {
tonic::Response<super::ProfileTreeResponse>,
tonic::Status,
>;
/// Lists the tables visible in one data-entry scope. When profile_name is
/// absent, only global tables are returned.
async fn get_table_catalog(
&self,
request: tonic::Request<super::GetTableCatalogRequest>,
) -> std::result::Result<
tonic::Response<super::GetTableCatalogResponse>,
tonic::Status,
>;
/// Lists every column type a table may declare, along with the SQL type it
/// maps to. Pure data retrieval - no business logic.
async fn list_column_types(
@@ -1309,6 +1360,52 @@ pub mod table_definition_server {
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/GetTableCatalog" => {
#[allow(non_camel_case_types)]
struct GetTableCatalogSvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<super::GetTableCatalogRequest>
for GetTableCatalogSvc<T> {
type Response = super::GetTableCatalogResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetTableCatalogRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::get_table_catalog(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetTableCatalogSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/ListColumnTypes" => {
#[allow(non_camel_case_types)]
struct ListColumnTypesSvc<T: TableDefinition>(pub Arc<T>);

2
server

Submodule server updated: 2bfe955a8d...32b38e5a5b