put table definition
This commit is contained in:
2
client
2
client
Submodule client updated: 9dbcd82f37...fc712732df
@@ -27,6 +27,11 @@ service TableDefinition {
|
||||
// Existing columns, links, and table logic are never changed by this call.
|
||||
rpc AddTableColumns(AddTableColumnsRequest) returns (TableDefinitionResponse);
|
||||
|
||||
// Atomically removes selected columns and appends new columns to an empty
|
||||
// dynamic table. Column identities come from GetProfileDetails. The call is
|
||||
// rejected after any row, including a soft-deleted row, has been stored.
|
||||
rpc PutTableDefinition(PutTableDefinitionRequest) returns (PutTableDefinitionResponse);
|
||||
|
||||
// Lists all profiles (schemas) and their tables with declared dependencies.
|
||||
// This provides a tree-like overview of table relationships.
|
||||
rpc GetProfileTree(komp_ac.common.Empty) returns (ProfileTreeResponse);
|
||||
@@ -203,6 +208,31 @@ message AddTableColumnsRequest {
|
||||
|
||||
}
|
||||
|
||||
// One atomic structural edit to an existing empty table.
|
||||
//
|
||||
// Removals use stable column IDs rather than aliases. Generated companion
|
||||
// columns must be removed together with their generating column. New columns
|
||||
// follow the same contract as AddTableColumns.
|
||||
message PutTableDefinitionRequest {
|
||||
string profile_name = 1;
|
||||
string table_name = 2;
|
||||
repeated int64 remove_column_ids = 3;
|
||||
repeated ColumnDefinition add_columns = 4;
|
||||
repeated string add_indexes = 5;
|
||||
repeated GeneratedColumnAlias generated_aliases = 6;
|
||||
|
||||
// Revision returned by GetProfileDetails. Prevents a stale editor from
|
||||
// overwriting a newer structural or presentation change.
|
||||
int64 expected_row_version = 7;
|
||||
}
|
||||
|
||||
message PutTableDefinitionResponse {
|
||||
bool success = 1;
|
||||
string sql = 2;
|
||||
int64 row_version = 3;
|
||||
repeated int64 removed_column_ids = 4;
|
||||
}
|
||||
|
||||
enum MoneyRounding {
|
||||
MONEY_ROUNDING_NONE = 0;
|
||||
MONEY_ROUNDING_HALF_UP = 1;
|
||||
|
||||
Binary file not shown.
@@ -165,6 +165,41 @@ pub struct AddTableColumnsRequest {
|
||||
#[prost(message, repeated, tag = "5")]
|
||||
pub generated_aliases: ::prost::alloc::vec::Vec<GeneratedColumnAlias>,
|
||||
}
|
||||
/// One atomic structural edit to an existing empty table.
|
||||
///
|
||||
/// Removals use stable column IDs rather than aliases. Generated companion
|
||||
/// columns must be removed together with their generating column. New columns
|
||||
/// follow the same contract as AddTableColumns.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct PutTableDefinitionRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub table_name: ::prost::alloc::string::String,
|
||||
#[prost(int64, repeated, tag = "3")]
|
||||
pub remove_column_ids: ::prost::alloc::vec::Vec<i64>,
|
||||
#[prost(message, repeated, tag = "4")]
|
||||
pub add_columns: ::prost::alloc::vec::Vec<ColumnDefinition>,
|
||||
#[prost(string, repeated, tag = "5")]
|
||||
pub add_indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
#[prost(message, repeated, tag = "6")]
|
||||
pub generated_aliases: ::prost::alloc::vec::Vec<GeneratedColumnAlias>,
|
||||
/// Revision returned by GetProfileDetails. Prevents a stale editor from
|
||||
/// overwriting a newer structural or presentation change.
|
||||
#[prost(int64, tag = "7")]
|
||||
pub expected_row_version: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct PutTableDefinitionResponse {
|
||||
#[prost(bool, tag = "1")]
|
||||
pub success: bool,
|
||||
#[prost(string, tag = "2")]
|
||||
pub sql: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "3")]
|
||||
pub row_version: i64,
|
||||
#[prost(int64, repeated, tag = "4")]
|
||||
pub removed_column_ids: ::prost::alloc::vec::Vec<i64>,
|
||||
}
|
||||
/// Describes one user-defined column for a table.
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
@@ -893,6 +928,38 @@ pub mod table_definition_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Atomically removes selected columns and appends new columns to an empty
|
||||
/// dynamic table. Column identities come from GetProfileDetails. The call is
|
||||
/// rejected after any row, including a soft-deleted row, has been stored.
|
||||
pub async fn put_table_definition(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::PutTableDefinitionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::PutTableDefinitionResponse>,
|
||||
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/PutTableDefinition",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.table_definition.TableDefinition",
|
||||
"PutTableDefinition",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Lists all profiles (schemas) and their tables with declared dependencies.
|
||||
/// This provides a tree-like overview of table relationships.
|
||||
pub async fn get_profile_tree(
|
||||
@@ -1191,6 +1258,16 @@ pub mod table_definition_server {
|
||||
tonic::Response<super::TableDefinitionResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Atomically removes selected columns and appends new columns to an empty
|
||||
/// dynamic table. Column identities come from GetProfileDetails. The call is
|
||||
/// rejected after any row, including a soft-deleted row, has been stored.
|
||||
async fn put_table_definition(
|
||||
&self,
|
||||
request: tonic::Request<super::PutTableDefinitionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::PutTableDefinitionResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Lists all profiles (schemas) and their tables with declared dependencies.
|
||||
/// This provides a tree-like overview of table relationships.
|
||||
async fn get_profile_tree(
|
||||
@@ -1542,6 +1619,55 @@ pub mod table_definition_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.table_definition.TableDefinition/PutTableDefinition" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct PutTableDefinitionSvc<T: TableDefinition>(pub Arc<T>);
|
||||
impl<
|
||||
T: TableDefinition,
|
||||
> tonic::server::UnaryService<super::PutTableDefinitionRequest>
|
||||
for PutTableDefinitionSvc<T> {
|
||||
type Response = super::PutTableDefinitionResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::PutTableDefinitionRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TableDefinition>::put_table_definition(
|
||||
&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 = PutTableDefinitionSvc(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/GetProfileTree" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetProfileTreeSvc<T: TableDefinition>(pub Arc<T>);
|
||||
|
||||
2
server
2
server
Submodule server updated: 0a8cf005d8...f559f57d40
Reference in New Issue
Block a user