boolean quantity ledger

This commit is contained in:
Filipriec
2026-08-29 15:30:04 +02:00
parent fead8685b6
commit 36d401f3a4
5 changed files with 53 additions and 5 deletions

View File

@@ -157,6 +157,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
".komp_ac.table_definition.ColumnDefinition",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.field_attribute(
".komp_ac.table_definition.ColumnDefinition.boolean_ledger_operator",
"#[serde(default)]",
)
.type_attribute(
".komp_ac.table_definition.PostTableDefinitionRequest",
"#[derive(serde::Serialize, serde::Deserialize)]",

View File

@@ -291,8 +291,8 @@ message ColumnDefinition {
// MONEY rounding applied before a value is stored.
MoneyRounding rounding = 3;
// When true, this numeric column is server-owned and projected from the
// profile quantity ledger.
// When true, this numeric or Boolean column is server-owned and projected
// from ledger contributions.
bool quantity_ledger = 4;
// Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden
@@ -301,6 +301,16 @@ message ColumnDefinition {
// When true, the server rejects omitted or explicitly null values.
bool required = 6;
// Required for Boolean ledger columns and forbidden otherwise. ANY means
// one true contribution wins; ALL means one false contribution wins.
BooleanLedgerOperator boolean_ledger_operator = 7;
}
enum BooleanLedgerOperator {
BOOLEAN_LEDGER_OPERATOR_UNSPECIFIED = 0;
BOOLEAN_LEDGER_OPERATOR_ANY = 1;
BOOLEAN_LEDGER_OPERATOR_ALL = 2;
}
// Response after table creation (success + DDL preview).

Binary file not shown.

View File

@@ -255,8 +255,8 @@ pub struct ColumnDefinition {
/// MONEY rounding applied before a value is stored.
#[prost(enumeration = "MoneyRounding", tag = "3")]
pub rounding: i32,
/// When true, this numeric column is server-owned and projected from the
/// profile quantity ledger.
/// When true, this numeric or Boolean column is server-owned and projected
/// from ledger contributions.
#[prost(bool, tag = "4")]
pub quantity_ledger: bool,
/// Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden
@@ -266,6 +266,11 @@ pub struct ColumnDefinition {
/// When true, the server rejects omitted or explicitly null values.
#[prost(bool, tag = "6")]
pub required: bool,
/// Required for Boolean ledger columns and forbidden otherwise. ANY means
/// one true contribution wins; ALL means one false contribution wins.
#[prost(enumeration = "BooleanLedgerOperator", tag = "7")]
#[serde(default)]
pub boolean_ledger_operator: i32,
}
/// Response after table creation (success + DDL preview).
#[derive(serde::Serialize, serde::Deserialize)]
@@ -677,6 +682,35 @@ impl MoneyRounding {
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum BooleanLedgerOperator {
Unspecified = 0,
Any = 1,
All = 2,
}
impl BooleanLedgerOperator {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "BOOLEAN_LEDGER_OPERATOR_UNSPECIFIED",
Self::Any => "BOOLEAN_LEDGER_OPERATOR_ANY",
Self::All => "BOOLEAN_LEDGER_OPERATOR_ALL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BOOLEAN_LEDGER_OPERATOR_UNSPECIFIED" => Some(Self::Unspecified),
"BOOLEAN_LEDGER_OPERATOR_ANY" => Some(Self::Any),
"BOOLEAN_LEDGER_OPERATOR_ALL" => Some(Self::All),
_ => None,
}
}
}
/// How a column type is spelled in ColumnDefinition.field_type.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]