doing the table definition columns in add_table
This commit is contained in:
2
client
2
client
Submodule client updated: d76107b4c4...278e3a6319
@@ -362,18 +362,69 @@ message DeleteTableResponse {
|
|||||||
string message = 2;
|
string message = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response listing every column type a table may declare.
|
// How a column type is spelled in ColumnDefinition.field_type.
|
||||||
|
enum ColumnTypeSpelling {
|
||||||
|
// The name is the whole spelling: "text", "money", "gtin_13".
|
||||||
|
COLUMN_TYPE_SPELLING_BARE = 0;
|
||||||
|
|
||||||
|
// The name takes a precision and a scale: "decimal(12,3)". Precision must be
|
||||||
|
// at least 1 and scale no greater than precision; neither may carry a sign,
|
||||||
|
// a decimal point, or leading zeros.
|
||||||
|
COLUMN_TYPE_SPELLING_DECIMAL = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Response describing the whole column-type vocabulary.
|
||||||
|
//
|
||||||
|
// This is the authority a client builds its column-type picker from: every rule
|
||||||
|
// a client would otherwise hardcode about what a type means is a field here. The
|
||||||
|
// list covers types clients may NOT declare as well (see `declarable`), so that
|
||||||
|
// the same call also explains the types GetProfileDetails reports back for
|
||||||
|
// server-generated companion columns.
|
||||||
message ListColumnTypesResponse {
|
message ListColumnTypesResponse {
|
||||||
// One declared column type and the SQL type it maps to.
|
// One column type and everything a client needs to know to offer it.
|
||||||
message ColumnType {
|
message ColumnType {
|
||||||
// Logical column type (e.g. "money", "instant"). Passed to the server as
|
// Logical column type (e.g. "money", "instant"). Passed to the server as
|
||||||
// ColumnDefinition.field_type.
|
// ColumnDefinition.field_type — see `spelling`, which is what says whether
|
||||||
|
// this name is the whole spelling.
|
||||||
string name = 1;
|
string name = 1;
|
||||||
|
|
||||||
// Underlying PostgreSQL type the logical type maps to (e.g. "NUMERIC").
|
// Underlying PostgreSQL type the logical type maps to (e.g. "NUMERIC").
|
||||||
|
// Empty when `compound` is true. For COLUMN_TYPE_SPELLING_DECIMAL this is
|
||||||
|
// the unparameterised type; the declared precision and scale are appended.
|
||||||
string sql_type = 2;
|
string sql_type = 2;
|
||||||
|
|
||||||
|
// False for types the server generates on its own and rejects when a client
|
||||||
|
// declares them: the phone and IBAN companions, and the accounting-transfer
|
||||||
|
// connectors. A column-type picker must offer only declarable types.
|
||||||
|
bool declarable = 3;
|
||||||
|
|
||||||
|
// True when the type is a definition row rather than a column: it expands
|
||||||
|
// into several schema-managed companion columns and no column of this name
|
||||||
|
// survives. A compound type can therefore never be indexed, never be a row
|
||||||
|
// display column, and has no single sql_type of its own.
|
||||||
|
bool compound = 4;
|
||||||
|
|
||||||
|
// Whether `name` is the whole spelling or takes arguments.
|
||||||
|
ColumnTypeSpelling spelling = 5;
|
||||||
|
|
||||||
|
// Whether ColumnDefinition.currency is required. Currency is rejected on
|
||||||
|
// every type where this is false.
|
||||||
|
bool requires_currency = 6;
|
||||||
|
|
||||||
|
// True when the type may only be chosen while the table is being created.
|
||||||
|
// AddTableColumns rejects these, because they bring schema-managed columns
|
||||||
|
// that cannot be bolted onto a table that already exists.
|
||||||
|
bool creation_only = 7;
|
||||||
|
|
||||||
|
// Whether ColumnDefinition.quantity_ledger may be set on this type.
|
||||||
|
bool allows_quantity_ledger = 8;
|
||||||
|
|
||||||
|
// Optional name grouping several types a client offers behind one choice —
|
||||||
|
// "temporal" for the date and time types, "gtin" for the GTIN lengths.
|
||||||
|
// Empty when the type stands on its own.
|
||||||
|
string group = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
// All declared column types.
|
// Every column type, declarable or not, ordered by name.
|
||||||
repeated ColumnType column_types = 1;
|
repeated ColumnType column_types = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -389,25 +389,65 @@ pub struct DeleteTableResponse {
|
|||||||
#[prost(string, tag = "2")]
|
#[prost(string, tag = "2")]
|
||||||
pub message: ::prost::alloc::string::String,
|
pub message: ::prost::alloc::string::String,
|
||||||
}
|
}
|
||||||
/// Response listing every column type a table may declare.
|
/// Response describing the whole column-type vocabulary.
|
||||||
|
///
|
||||||
|
/// This is the authority a client builds its column-type picker from: every rule
|
||||||
|
/// a client would otherwise hardcode about what a type means is a field here. The
|
||||||
|
/// list covers types clients may NOT declare as well (see `declarable`), so that
|
||||||
|
/// the same call also explains the types GetProfileDetails reports back for
|
||||||
|
/// server-generated companion columns.
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct ListColumnTypesResponse {
|
pub struct ListColumnTypesResponse {
|
||||||
/// All declared column types.
|
/// Every column type, declarable or not, ordered by name.
|
||||||
#[prost(message, repeated, tag = "1")]
|
#[prost(message, repeated, tag = "1")]
|
||||||
pub column_types: ::prost::alloc::vec::Vec<list_column_types_response::ColumnType>,
|
pub column_types: ::prost::alloc::vec::Vec<list_column_types_response::ColumnType>,
|
||||||
}
|
}
|
||||||
/// Nested message and enum types in `ListColumnTypesResponse`.
|
/// Nested message and enum types in `ListColumnTypesResponse`.
|
||||||
pub mod list_column_types_response {
|
pub mod list_column_types_response {
|
||||||
/// One declared column type and the SQL type it maps to.
|
/// One column type and everything a client needs to know to offer it.
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
pub struct ColumnType {
|
pub struct ColumnType {
|
||||||
/// Logical column type (e.g. "money", "instant"). Passed to the server as
|
/// Logical column type (e.g. "money", "instant"). Passed to the server as
|
||||||
/// ColumnDefinition.field_type.
|
/// ColumnDefinition.field_type — see `spelling`, which is what says whether
|
||||||
|
/// this name is the whole spelling.
|
||||||
#[prost(string, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
pub name: ::prost::alloc::string::String,
|
pub name: ::prost::alloc::string::String,
|
||||||
/// Underlying PostgreSQL type the logical type maps to (e.g. "NUMERIC").
|
/// Underlying PostgreSQL type the logical type maps to (e.g. "NUMERIC").
|
||||||
|
/// Empty when `compound` is true. For COLUMN_TYPE_SPELLING_DECIMAL this is
|
||||||
|
/// the unparameterised type; the declared precision and scale are appended.
|
||||||
#[prost(string, tag = "2")]
|
#[prost(string, tag = "2")]
|
||||||
pub sql_type: ::prost::alloc::string::String,
|
pub sql_type: ::prost::alloc::string::String,
|
||||||
|
/// False for types the server generates on its own and rejects when a client
|
||||||
|
/// declares them: the phone and IBAN companions, and the accounting-transfer
|
||||||
|
/// connectors. A column-type picker must offer only declarable types.
|
||||||
|
#[prost(bool, tag = "3")]
|
||||||
|
pub declarable: bool,
|
||||||
|
/// True when the type is a definition row rather than a column: it expands
|
||||||
|
/// into several schema-managed companion columns and no column of this name
|
||||||
|
/// survives. A compound type can therefore never be indexed, never be a row
|
||||||
|
/// display column, and has no single sql_type of its own.
|
||||||
|
#[prost(bool, tag = "4")]
|
||||||
|
pub compound: bool,
|
||||||
|
/// Whether `name` is the whole spelling or takes arguments.
|
||||||
|
#[prost(enumeration = "super::ColumnTypeSpelling", tag = "5")]
|
||||||
|
pub spelling: i32,
|
||||||
|
/// Whether ColumnDefinition.currency is required. Currency is rejected on
|
||||||
|
/// every type where this is false.
|
||||||
|
#[prost(bool, tag = "6")]
|
||||||
|
pub requires_currency: bool,
|
||||||
|
/// True when the type may only be chosen while the table is being created.
|
||||||
|
/// AddTableColumns rejects these, because they bring schema-managed columns
|
||||||
|
/// that cannot be bolted onto a table that already exists.
|
||||||
|
#[prost(bool, tag = "7")]
|
||||||
|
pub creation_only: bool,
|
||||||
|
/// Whether ColumnDefinition.quantity_ledger may be set on this type.
|
||||||
|
#[prost(bool, tag = "8")]
|
||||||
|
pub allows_quantity_ledger: bool,
|
||||||
|
/// Optional name grouping several types a client offers behind one choice —
|
||||||
|
/// "temporal" for the date and time types, "gtin" for the GTIN lengths.
|
||||||
|
/// Empty when the type stands on its own.
|
||||||
|
#[prost(string, tag = "9")]
|
||||||
|
pub group: ::prost::alloc::string::String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||||
@@ -436,6 +476,37 @@ impl MoneyRounding {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// How a column type is spelled in ColumnDefinition.field_type.
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||||
|
#[repr(i32)]
|
||||||
|
pub enum ColumnTypeSpelling {
|
||||||
|
/// The name is the whole spelling: "text", "money", "gtin_13".
|
||||||
|
Bare = 0,
|
||||||
|
/// The name takes a precision and a scale: "decimal(12,3)". Precision must be
|
||||||
|
/// at least 1 and scale no greater than precision; neither may carry a sign,
|
||||||
|
/// a decimal point, or leading zeros.
|
||||||
|
Decimal = 1,
|
||||||
|
}
|
||||||
|
impl ColumnTypeSpelling {
|
||||||
|
/// 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::Bare => "COLUMN_TYPE_SPELLING_BARE",
|
||||||
|
Self::Decimal => "COLUMN_TYPE_SPELLING_DECIMAL",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
||||||
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
||||||
|
match value {
|
||||||
|
"COLUMN_TYPE_SPELLING_BARE" => Some(Self::Bare),
|
||||||
|
"COLUMN_TYPE_SPELLING_DECIMAL" => Some(Self::Decimal),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// Generated client implementations.
|
/// Generated client implementations.
|
||||||
pub mod table_definition_client {
|
pub mod table_definition_client {
|
||||||
#![allow(
|
#![allow(
|
||||||
|
|||||||
2
server
2
server
Submodule server updated: 0a685313f4...cb9906ac3e
Submodule tui-canvas updated: eca3d6294f...a391929f8f
Submodule tui-pages updated: 1a33d6d8df...7648522be1
Reference in New Issue
Block a user