refering different tables that are not directly FK5
This commit is contained in:
@@ -42,6 +42,9 @@ service TableScript {
|
||||
// - Includes normalized dependency metadata from script_dependencies
|
||||
// - Returns an empty scripts list when the table has no scripts
|
||||
rpc GetTableScripts(GetTableScriptsRequest) returns (GetTableScriptsResponse);
|
||||
|
||||
rpc GetScriptDependencyValues(GetScriptDependencyValuesRequest)
|
||||
returns (GetScriptDependencyValuesResponse);
|
||||
}
|
||||
|
||||
// Request to create or update a script bound to a specific table and column.
|
||||
@@ -140,3 +143,22 @@ message ScriptDependency {
|
||||
// Relationship table used to match the owner row to the related collection.
|
||||
string via_table = 6;
|
||||
}
|
||||
|
||||
message GetScriptDependencyValuesRequest {
|
||||
string profile_name = 1;
|
||||
string table_name = 2;
|
||||
int64 row_id = 3;
|
||||
map<string, string> row_data = 4;
|
||||
}
|
||||
|
||||
message ScriptDependencyValue {
|
||||
string operation = 1;
|
||||
string target_table = 2;
|
||||
string column = 3;
|
||||
string via_table = 4;
|
||||
string value = 5;
|
||||
}
|
||||
|
||||
message GetScriptDependencyValuesResponse {
|
||||
repeated ScriptDependencyValue values = 1;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user