better new functionality of column aliases
This commit is contained in:
2
client
2
client
Submodule client updated: ab990ac128...cdce1fc5f4
@@ -61,6 +61,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
".komp_ac.table_definition.TableDefinitionResponse",
|
".komp_ac.table_definition.TableDefinitionResponse",
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]"
|
"#[derive(serde::Serialize, serde::Deserialize)]"
|
||||||
)
|
)
|
||||||
|
.type_attribute(
|
||||||
|
".komp_ac.table_definition.GetColumnAliasRenameHistoryRequest",
|
||||||
|
"#[derive(serde::Serialize, serde::Deserialize)]"
|
||||||
|
)
|
||||||
|
.type_attribute(
|
||||||
|
".komp_ac.table_definition.ColumnAliasRenameHistoryEntry",
|
||||||
|
"#[derive(serde::Serialize, serde::Deserialize)]"
|
||||||
|
)
|
||||||
|
.type_attribute(
|
||||||
|
".komp_ac.table_definition.GetColumnAliasRenameHistoryResponse",
|
||||||
|
"#[derive(serde::Serialize, serde::Deserialize)]"
|
||||||
|
)
|
||||||
.type_attribute(
|
.type_attribute(
|
||||||
".komp_ac.table_definition.RenameColumnAliasRequest",
|
".komp_ac.table_definition.RenameColumnAliasRequest",
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]"
|
"#[derive(serde::Serialize, serde::Deserialize)]"
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ service TableDefinition {
|
|||||||
// Pure data retrieval - no business logic.
|
// Pure data retrieval - no business logic.
|
||||||
rpc GetProfileDetails(GetProfileDetailsRequest) returns (GetProfileDetailsResponse);
|
rpc GetProfileDetails(GetProfileDetailsRequest) returns (GetProfileDetailsResponse);
|
||||||
|
|
||||||
|
// Returns the stored rename history for column aliases in one profile.
|
||||||
|
rpc GetColumnAliasRenameHistory(GetColumnAliasRenameHistoryRequest) returns (GetColumnAliasRenameHistoryResponse);
|
||||||
|
|
||||||
// Renames a user-visible column alias while keeping the physical column unchanged.
|
// Renames a user-visible column alias while keeping the physical column unchanged.
|
||||||
rpc RenameColumnAlias(RenameColumnAliasRequest) returns (RenameColumnAliasResponse);
|
rpc RenameColumnAlias(RenameColumnAliasRequest) returns (RenameColumnAliasResponse);
|
||||||
|
|
||||||
@@ -138,6 +141,31 @@ message GetProfileDetailsResponse {
|
|||||||
repeated TableDetail tables = 2;
|
repeated TableDetail tables = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Request to fetch recorded column alias rename history for one profile.
|
||||||
|
message GetColumnAliasRenameHistoryRequest {
|
||||||
|
string profile_name = 1;
|
||||||
|
|
||||||
|
// Optional filter. When omitted, returns all tables in the profile.
|
||||||
|
optional int64 table_definition_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// One recorded column alias rename.
|
||||||
|
message ColumnAliasRenameHistoryEntry {
|
||||||
|
int64 id = 1;
|
||||||
|
string profile_name = 2;
|
||||||
|
int64 table_definition_id = 3;
|
||||||
|
string table_name = 4;
|
||||||
|
string old_column_name = 5;
|
||||||
|
string new_column_name = 6;
|
||||||
|
string created_at = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Response with stored column alias rename history rows.
|
||||||
|
message GetColumnAliasRenameHistoryResponse {
|
||||||
|
string profile_name = 1;
|
||||||
|
repeated ColumnAliasRenameHistoryEntry entries = 2;
|
||||||
|
}
|
||||||
|
|
||||||
// Describes a table with its columns and associated scripts.
|
// Describes a table with its columns and associated scripts.
|
||||||
message TableDetail {
|
message TableDetail {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
|
|||||||
Binary file not shown.
@@ -125,6 +125,44 @@ pub struct GetProfileDetailsResponse {
|
|||||||
#[prost(message, repeated, tag = "2")]
|
#[prost(message, repeated, tag = "2")]
|
||||||
pub tables: ::prost::alloc::vec::Vec<TableDetail>,
|
pub tables: ::prost::alloc::vec::Vec<TableDetail>,
|
||||||
}
|
}
|
||||||
|
/// Request to fetch recorded column alias rename history for one profile.
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct GetColumnAliasRenameHistoryRequest {
|
||||||
|
#[prost(string, tag = "1")]
|
||||||
|
pub profile_name: ::prost::alloc::string::String,
|
||||||
|
/// Optional filter. When omitted, returns all tables in the profile.
|
||||||
|
#[prost(int64, optional, tag = "2")]
|
||||||
|
pub table_definition_id: ::core::option::Option<i64>,
|
||||||
|
}
|
||||||
|
/// One recorded column alias rename.
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct ColumnAliasRenameHistoryEntry {
|
||||||
|
#[prost(int64, tag = "1")]
|
||||||
|
pub id: i64,
|
||||||
|
#[prost(string, tag = "2")]
|
||||||
|
pub profile_name: ::prost::alloc::string::String,
|
||||||
|
#[prost(int64, tag = "3")]
|
||||||
|
pub table_definition_id: i64,
|
||||||
|
#[prost(string, tag = "4")]
|
||||||
|
pub table_name: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag = "5")]
|
||||||
|
pub old_column_name: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag = "6")]
|
||||||
|
pub new_column_name: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag = "7")]
|
||||||
|
pub created_at: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
/// Response with stored column alias rename history rows.
|
||||||
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct GetColumnAliasRenameHistoryResponse {
|
||||||
|
#[prost(string, tag = "1")]
|
||||||
|
pub profile_name: ::prost::alloc::string::String,
|
||||||
|
#[prost(message, repeated, tag = "2")]
|
||||||
|
pub entries: ::prost::alloc::vec::Vec<ColumnAliasRenameHistoryEntry>,
|
||||||
|
}
|
||||||
/// Describes a table with its columns and associated scripts.
|
/// Describes a table with its columns and associated scripts.
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct TableDetail {
|
pub struct TableDetail {
|
||||||
@@ -383,6 +421,36 @@ pub mod table_definition_client {
|
|||||||
);
|
);
|
||||||
self.inner.unary(req, path, codec).await
|
self.inner.unary(req, path, codec).await
|
||||||
}
|
}
|
||||||
|
/// Returns the stored rename history for column aliases in one profile.
|
||||||
|
pub async fn get_column_alias_rename_history(
|
||||||
|
&mut self,
|
||||||
|
request: impl tonic::IntoRequest<super::GetColumnAliasRenameHistoryRequest>,
|
||||||
|
) -> std::result::Result<
|
||||||
|
tonic::Response<super::GetColumnAliasRenameHistoryResponse>,
|
||||||
|
tonic::Status,
|
||||||
|
> {
|
||||||
|
self.inner
|
||||||
|
.ready()
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
tonic::Status::unknown(
|
||||||
|
format!("Service was not ready: {}", e.into()),
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
let codec = tonic::codec::ProstCodec::default();
|
||||||
|
let path = http::uri::PathAndQuery::from_static(
|
||||||
|
"/komp_ac.table_definition.TableDefinition/GetColumnAliasRenameHistory",
|
||||||
|
);
|
||||||
|
let mut req = request.into_request();
|
||||||
|
req.extensions_mut()
|
||||||
|
.insert(
|
||||||
|
GrpcMethod::new(
|
||||||
|
"komp_ac.table_definition.TableDefinition",
|
||||||
|
"GetColumnAliasRenameHistory",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
self.inner.unary(req, path, codec).await
|
||||||
|
}
|
||||||
/// Renames a user-visible column alias while keeping the physical column unchanged.
|
/// Renames a user-visible column alias while keeping the physical column unchanged.
|
||||||
pub async fn rename_column_alias(
|
pub async fn rename_column_alias(
|
||||||
&mut self,
|
&mut self,
|
||||||
@@ -486,6 +554,14 @@ pub mod table_definition_server {
|
|||||||
tonic::Response<super::GetProfileDetailsResponse>,
|
tonic::Response<super::GetProfileDetailsResponse>,
|
||||||
tonic::Status,
|
tonic::Status,
|
||||||
>;
|
>;
|
||||||
|
/// Returns the stored rename history for column aliases in one profile.
|
||||||
|
async fn get_column_alias_rename_history(
|
||||||
|
&self,
|
||||||
|
request: tonic::Request<super::GetColumnAliasRenameHistoryRequest>,
|
||||||
|
) -> std::result::Result<
|
||||||
|
tonic::Response<super::GetColumnAliasRenameHistoryResponse>,
|
||||||
|
tonic::Status,
|
||||||
|
>;
|
||||||
/// Renames a user-visible column alias while keeping the physical column unchanged.
|
/// Renames a user-visible column alias while keeping the physical column unchanged.
|
||||||
async fn rename_column_alias(
|
async fn rename_column_alias(
|
||||||
&self,
|
&self,
|
||||||
@@ -724,6 +800,60 @@ pub mod table_definition_server {
|
|||||||
};
|
};
|
||||||
Box::pin(fut)
|
Box::pin(fut)
|
||||||
}
|
}
|
||||||
|
"/komp_ac.table_definition.TableDefinition/GetColumnAliasRenameHistory" => {
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
struct GetColumnAliasRenameHistorySvc<T: TableDefinition>(
|
||||||
|
pub Arc<T>,
|
||||||
|
);
|
||||||
|
impl<
|
||||||
|
T: TableDefinition,
|
||||||
|
> tonic::server::UnaryService<
|
||||||
|
super::GetColumnAliasRenameHistoryRequest,
|
||||||
|
> for GetColumnAliasRenameHistorySvc<T> {
|
||||||
|
type Response = super::GetColumnAliasRenameHistoryResponse;
|
||||||
|
type Future = BoxFuture<
|
||||||
|
tonic::Response<Self::Response>,
|
||||||
|
tonic::Status,
|
||||||
|
>;
|
||||||
|
fn call(
|
||||||
|
&mut self,
|
||||||
|
request: tonic::Request<
|
||||||
|
super::GetColumnAliasRenameHistoryRequest,
|
||||||
|
>,
|
||||||
|
) -> Self::Future {
|
||||||
|
let inner = Arc::clone(&self.0);
|
||||||
|
let fut = async move {
|
||||||
|
<T as TableDefinition>::get_column_alias_rename_history(
|
||||||
|
&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 = GetColumnAliasRenameHistorySvc(inner);
|
||||||
|
let codec = tonic::codec::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/RenameColumnAlias" => {
|
"/komp_ac.table_definition.TableDefinition/RenameColumnAlias" => {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
struct RenameColumnAliasSvc<T: TableDefinition>(pub Arc<T>);
|
struct RenameColumnAliasSvc<T: TableDefinition>(pub Arc<T>);
|
||||||
|
|||||||
2
server
2
server
Submodule server updated: 403785118a...8dbe9cc14c
Reference in New Issue
Block a user