reference a value from other linked table

This commit is contained in:
Priec
2026-09-04 23:02:44 +02:00
parent 6689e6c7f9
commit 40e6b6dff3
5 changed files with 42 additions and 14 deletions

Binary file not shown.

View File

@@ -25,9 +25,9 @@ pub struct PostTableDefinitionRequest {
/// allowed.
#[prost(string, tag = "1")]
pub table_name: ::prost::alloc::string::String,
/// The table's columns, including its links and stored linked projections.
/// A projection uses field_type FROM(link_column.source_column); its physical
/// type and money metadata are inferred from the linked source column.
/// The table's columns, including its links and stored linked values.
/// A linked value uses ColumnDefinition.linked_value; its physical type and
/// money metadata are inferred from the linked source column.
#[prost(message, repeated, tag = "3")]
pub columns: ::prost::alloc::vec::Vec<ColumnDefinition>,
/// Column names to index, matching names declared above. System columns
@@ -201,7 +201,7 @@ pub struct AddTableColumnsRequest {
#[prost(string, tag = "2")]
pub table_name: ::prost::alloc::string::String,
/// New user-defined columns only. Existing columns cannot be changed here.
/// Stored linked projections use field_type FROM(link_column.source_column).
/// Stored linked values use ColumnDefinition.linked_value.
#[prost(message, repeated, tag = "3")]
pub columns: ::prost::alloc::vec::Vec<ColumnDefinition>,
/// Optional indexes for the new columns only.
@@ -255,6 +255,7 @@ pub struct PutTableDefinitionResponse {
}
/// Describes one user-defined column for a table.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ColumnDefinition {
/// Public display name for this column; the physical column uses a stable
@@ -292,9 +293,6 @@ pub struct ColumnDefinition {
/// LINK(table) → BIGINT referencing that table in the same profile, indexed
/// automatically. A table may hold several links to the same
/// target as long as the columns are named differently.
/// FROM(link.source) → stored, read-only copy of an atomic column reached
/// through another column in this definition whose type is
/// LINK(...). SQL type and money metadata are inferred.
#[prost(string, tag = "2")]
pub field_type: ::prost::alloc::string::String,
/// MONEY rounding applied before a value is stored.
@@ -316,6 +314,21 @@ pub struct ColumnDefinition {
#[prost(enumeration = "BooleanLedgerOperator", tag = "7")]
#[serde(default, alias = "boolean_ledger_operator")]
pub boolean_ledger: i32,
/// Defines this named column as a stored, read-only value copied through an
/// existing LINK column. field_type and money metadata are inferred from the
/// source column and must not be supplied by the caller.
#[prost(message, optional, tag = "8")]
pub linked_value: ::core::option::Option<LinkedValueDefinition>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LinkedValueDefinition {
/// Exact display name of a LINK column in the table being defined.
#[prost(string, tag = "1")]
pub link_column: ::prost::alloc::string::String,
/// Exact display name of an atomic column in the linked table.
#[prost(string, tag = "2")]
pub source_column: ::prost::alloc::string::String,
}
/// Response after table creation (success + DDL preview).
#[derive(serde::Serialize, serde::Deserialize)]