refering different tables that are not directly FK5

This commit is contained in:
Priec
2026-07-16 21:12:06 +02:00
parent b765a3684c
commit 2ad1c8262b
5 changed files with 144 additions and 2 deletions

Binary file not shown.

View File

@@ -119,6 +119,38 @@ pub struct ScriptDependency {
#[prost(string, tag = "6")]
pub via_table: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetScriptDependencyValuesRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub table_name: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub row_id: i64,
#[prost(map = "string, string", tag = "4")]
pub row_data: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScriptDependencyValue {
#[prost(string, tag = "1")]
pub operation: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub target_table: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub column: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub via_table: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub value: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetScriptDependencyValuesResponse {
#[prost(message, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<ScriptDependencyValue>,
}
/// Generated client implementations.
pub mod table_script_client {
#![allow(
@@ -307,6 +339,35 @@ pub mod table_script_client {
);
self.inner.unary(req, path, codec).await
}
pub async fn get_script_dependency_values(
&mut self,
request: impl tonic::IntoRequest<super::GetScriptDependencyValuesRequest>,
) -> std::result::Result<
tonic::Response<super::GetScriptDependencyValuesResponse>,
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_script.TableScript/GetScriptDependencyValues",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_script.TableScript",
"GetScriptDependencyValues",
),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
@@ -362,6 +423,13 @@ pub mod table_script_server {
tonic::Response<super::GetTableScriptsResponse>,
tonic::Status,
>;
async fn get_script_dependency_values(
&self,
request: tonic::Request<super::GetScriptDependencyValuesRequest>,
) -> std::result::Result<
tonic::Response<super::GetScriptDependencyValuesResponse>,
tonic::Status,
>;
}
/// Manages column-computation scripts for user-defined tables.
/// Each script belongs to a single table (table_definition_id) and populates
@@ -542,6 +610,58 @@ pub mod table_script_server {
};
Box::pin(fut)
}
"/komp_ac.table_script.TableScript/GetScriptDependencyValues" => {
#[allow(non_camel_case_types)]
struct GetScriptDependencyValuesSvc<T: TableScript>(pub Arc<T>);
impl<
T: TableScript,
> tonic::server::UnaryService<
super::GetScriptDependencyValuesRequest,
> for GetScriptDependencyValuesSvc<T> {
type Response = super::GetScriptDependencyValuesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::GetScriptDependencyValuesRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableScript>::get_script_dependency_values(
&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 = GetScriptDependencyValuesSvc(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)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(