new enum instead of string in proto

This commit is contained in:
Priec
2026-09-07 09:54:32 +02:00
parent 6dc20bf7ad
commit e4364e1c44
16 changed files with 122 additions and 40 deletions

Binary file not shown.

View File

@@ -42,8 +42,8 @@ pub struct SearchIndexError {
pub table_name: ::prost::alloc::string::String,
#[prost(int64, tag = "4")]
pub row_id: i64,
#[prost(string, tag = "5")]
pub operation: ::prost::alloc::string::String,
#[prost(enumeration = "SearchIndexOperation", tag = "5")]
pub operation: i32,
#[prost(int32, tag = "6")]
pub attempts: i32,
#[prost(string, tag = "7")]
@@ -181,6 +181,36 @@ pub struct BatchCountResponse {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SearchIndexOperation {
Unspecified = 0,
Upsert = 1,
Delete = 2,
}
impl SearchIndexOperation {
/// 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 => "SEARCH_INDEX_OPERATION_UNSPECIFIED",
Self::Upsert => "SEARCH_INDEX_OPERATION_UPSERT",
Self::Delete => "SEARCH_INDEX_OPERATION_DELETE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SEARCH_INDEX_OPERATION_UNSPECIFIED" => Some(Self::Unspecified),
"SEARCH_INDEX_OPERATION_UPSERT" => Some(Self::Upsert),
"SEARCH_INDEX_OPERATION_DELETE" => Some(Self::Delete),
_ => None,
}
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MatchMode {
Unspecified = 0,
Fuzzy = 1,

View File

@@ -389,8 +389,8 @@ pub mod profile_tree_response {
::prost::alloc::string::String,
>,
/// "dynamic" for user-defined tables, "system" for backend-managed tables.
#[prost(string, tag = "5")]
pub table_kind: ::prost::alloc::string::String,
#[prost(enumeration = "super::ManagedTableKind", tag = "5")]
pub table_kind: i32,
/// True when this table is shared by every profile.
#[prost(bool, tag = "6")]
pub global: bool,
@@ -625,8 +625,8 @@ pub struct TableDetail {
::prost::alloc::string::String,
ColumnBehavior,
>,
#[prost(string, tag = "8")]
pub table_kind: ::prost::alloc::string::String,
#[prost(enumeration = "ManagedTableKind", tag = "8")]
pub table_kind: i32,
#[prost(bool, tag = "9")]
pub global: bool,
/// Revision of this table definition for optimistic concurrency control.
@@ -1156,6 +1156,36 @@ impl AliasChangeKind {
}
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ManagedTableKind {
Unspecified = 0,
Dynamic = 1,
System = 2,
}
impl ManagedTableKind {
/// 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 => "MANAGED_TABLE_KIND_UNSPECIFIED",
Self::Dynamic => "MANAGED_TABLE_KIND_DYNAMIC",
Self::System => "MANAGED_TABLE_KIND_SYSTEM",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MANAGED_TABLE_KIND_UNSPECIFIED" => Some(Self::Unspecified),
"MANAGED_TABLE_KIND_DYNAMIC" => Some(Self::Dynamic),
"MANAGED_TABLE_KIND_SYSTEM" => Some(Self::System),
_ => None,
}
}
}
/// How a column type is spelled in ColumnDefinition.field_type.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]