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

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)]