money without backwards compatibility
This commit is contained in:
@@ -173,14 +173,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
".komp_ac.table_definition.MoneyColumnOptions",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_definition.PostMoneyTableDefinitionRequest",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_definition.AddMoneyTableColumnsRequest",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_definition.TableDefinitionResponse",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]"
|
||||
|
||||
@@ -14,16 +14,10 @@ service TableDefinition {
|
||||
// Also inserts metadata and default validation rules. Entirely transactional.
|
||||
rpc PostTableDefinition(PostTableDefinitionRequest) returns (TableDefinitionResponse);
|
||||
|
||||
// Creates a table using the money-aware definition contract.
|
||||
rpc PostMoneyTableDefinition(PostMoneyTableDefinitionRequest) returns (TableDefinitionResponse);
|
||||
|
||||
// Appends new user-defined columns to an existing table.
|
||||
// Existing columns, links, and table logic are never changed by this call.
|
||||
rpc AddTableColumns(AddTableColumnsRequest) returns (TableDefinitionResponse);
|
||||
|
||||
// Adds columns using the money-aware definition contract.
|
||||
rpc AddMoneyTableColumns(AddMoneyTableColumnsRequest) returns (TableDefinitionResponse);
|
||||
|
||||
// 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);
|
||||
@@ -84,12 +78,9 @@ message PostTableDefinitionRequest {
|
||||
// like "public", "information_schema", or ones starting with "pg_".
|
||||
string profile_name = 5;
|
||||
|
||||
}
|
||||
string base_currency = 6;
|
||||
repeated MoneyColumnOptions money_columns = 7;
|
||||
|
||||
message PostMoneyTableDefinitionRequest {
|
||||
PostTableDefinitionRequest definition = 1;
|
||||
string base_currency = 2;
|
||||
repeated MoneyColumnOptions money_columns = 3;
|
||||
}
|
||||
|
||||
// Defines append-only column additions for an existing table.
|
||||
@@ -106,12 +97,9 @@ message AddTableColumnsRequest {
|
||||
// Optional indexes for the new columns only.
|
||||
repeated string indexes = 4;
|
||||
|
||||
}
|
||||
repeated MoneyColumnOptions money_columns = 5;
|
||||
string base_currency = 6;
|
||||
|
||||
message AddMoneyTableColumnsRequest {
|
||||
AddTableColumnsRequest definition = 1;
|
||||
repeated MoneyColumnOptions money_columns = 2;
|
||||
string base_currency = 3;
|
||||
}
|
||||
|
||||
enum MoneyRounding {
|
||||
|
||||
Binary file not shown.
@@ -42,15 +42,9 @@ pub struct PostTableDefinitionRequest {
|
||||
/// like "public", "information_schema", or ones starting with "pg\_".
|
||||
#[prost(string, tag = "5")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct PostMoneyTableDefinitionRequest {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub definition: ::core::option::Option<PostTableDefinitionRequest>,
|
||||
#[prost(string, tag = "2")]
|
||||
#[prost(string, tag = "6")]
|
||||
pub base_currency: ::prost::alloc::string::String,
|
||||
#[prost(message, repeated, tag = "3")]
|
||||
#[prost(message, repeated, tag = "7")]
|
||||
pub money_columns: ::prost::alloc::vec::Vec<MoneyColumnOptions>,
|
||||
}
|
||||
/// Defines append-only column additions for an existing table.
|
||||
@@ -69,15 +63,9 @@ pub struct AddTableColumnsRequest {
|
||||
/// Optional indexes for the new columns only.
|
||||
#[prost(string, repeated, tag = "4")]
|
||||
pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct AddMoneyTableColumnsRequest {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub definition: ::core::option::Option<AddTableColumnsRequest>,
|
||||
#[prost(message, repeated, tag = "2")]
|
||||
#[prost(message, repeated, tag = "5")]
|
||||
pub money_columns: ::prost::alloc::vec::Vec<MoneyColumnOptions>,
|
||||
#[prost(string, tag = "3")]
|
||||
#[prost(string, tag = "6")]
|
||||
pub base_currency: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
@@ -460,36 +448,6 @@ pub mod table_definition_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Creates a table using the money-aware definition contract.
|
||||
pub async fn post_money_table_definition(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::PostMoneyTableDefinitionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::TableDefinitionResponse>,
|
||||
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/PostMoneyTableDefinition",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.table_definition.TableDefinition",
|
||||
"PostMoneyTableDefinition",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Appends new user-defined columns to an existing table.
|
||||
/// Existing columns, links, and table logic are never changed by this call.
|
||||
pub async fn add_table_columns(
|
||||
@@ -521,36 +479,6 @@ pub mod table_definition_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Adds columns using the money-aware definition contract.
|
||||
pub async fn add_money_table_columns(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::AddMoneyTableColumnsRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::TableDefinitionResponse>,
|
||||
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/AddMoneyTableColumns",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.table_definition.TableDefinition",
|
||||
"AddMoneyTableColumns",
|
||||
),
|
||||
);
|
||||
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(
|
||||
@@ -758,14 +686,6 @@ pub mod table_definition_server {
|
||||
tonic::Response<super::TableDefinitionResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Creates a table using the money-aware definition contract.
|
||||
async fn post_money_table_definition(
|
||||
&self,
|
||||
request: tonic::Request<super::PostMoneyTableDefinitionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::TableDefinitionResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Appends new user-defined columns to an existing table.
|
||||
/// Existing columns, links, and table logic are never changed by this call.
|
||||
async fn add_table_columns(
|
||||
@@ -775,14 +695,6 @@ pub mod table_definition_server {
|
||||
tonic::Response<super::TableDefinitionResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Adds columns using the money-aware definition contract.
|
||||
async fn add_money_table_columns(
|
||||
&self,
|
||||
request: tonic::Request<super::AddMoneyTableColumnsRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::TableDefinitionResponse>,
|
||||
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(
|
||||
@@ -963,57 +875,6 @@ pub mod table_definition_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.table_definition.TableDefinition/PostMoneyTableDefinition" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct PostMoneyTableDefinitionSvc<T: TableDefinition>(pub Arc<T>);
|
||||
impl<
|
||||
T: TableDefinition,
|
||||
> tonic::server::UnaryService<super::PostMoneyTableDefinitionRequest>
|
||||
for PostMoneyTableDefinitionSvc<T> {
|
||||
type Response = super::TableDefinitionResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<
|
||||
super::PostMoneyTableDefinitionRequest,
|
||||
>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TableDefinition>::post_money_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 = PostMoneyTableDefinitionSvc(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/AddTableColumns" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct AddTableColumnsSvc<T: TableDefinition>(pub Arc<T>);
|
||||
@@ -1060,55 +921,6 @@ pub mod table_definition_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.table_definition.TableDefinition/AddMoneyTableColumns" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct AddMoneyTableColumnsSvc<T: TableDefinition>(pub Arc<T>);
|
||||
impl<
|
||||
T: TableDefinition,
|
||||
> tonic::server::UnaryService<super::AddMoneyTableColumnsRequest>
|
||||
for AddMoneyTableColumnsSvc<T> {
|
||||
type Response = super::TableDefinitionResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::AddMoneyTableColumnsRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TableDefinition>::add_money_table_columns(
|
||||
&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 = AddMoneyTableColumnsSvc(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: de3235a13c...591c4b0875
Reference in New Issue
Block a user