use crate::catalog::*;
impl serde::Serialize for ColIndexMapping {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.target_size != 0 {
len += 1;
}
if !self.map.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.ColIndexMapping", len)?;
if self.target_size != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("targetSize", ToString::to_string(&self.target_size).as_str())?;
}
if !self.map.is_empty() {
struct_ser.serialize_field("map", &self.map.iter().map(ToString::to_string).collect::<Vec<_>>())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ColIndexMapping {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"target_size",
"targetSize",
"map",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
TargetSize,
Map,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"targetSize" | "target_size" => Ok(GeneratedField::TargetSize),
"map" => Ok(GeneratedField::Map),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ColIndexMapping;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.ColIndexMapping")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ColIndexMapping, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut target_size__ = None;
let mut map__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::TargetSize => {
if target_size__.is_some() {
return Err(serde::de::Error::duplicate_field("targetSize"));
}
target_size__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Map => {
if map__.is_some() {
return Err(serde::de::Error::duplicate_field("map"));
}
map__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
}
}
Ok(ColIndexMapping {
target_size: target_size__.unwrap_or_default(),
map: map__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.ColIndexMapping", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for Comment {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.table_id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if self.column_index.is_some() {
len += 1;
}
if self.description.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Comment", len)?;
if self.table_id != 0 {
struct_ser.serialize_field("tableId", &self.table_id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if let Some(v) = self.column_index.as_ref() {
struct_ser.serialize_field("columnIndex", v)?;
}
if let Some(v) = self.description.as_ref() {
struct_ser.serialize_field("description", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Comment {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"table_id",
"tableId",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"column_index",
"columnIndex",
"description",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
TableId,
SchemaId,
DatabaseId,
ColumnIndex,
Description,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"tableId" | "table_id" => Ok(GeneratedField::TableId),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"columnIndex" | "column_index" => Ok(GeneratedField::ColumnIndex),
"description" => Ok(GeneratedField::Description),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Comment;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Comment")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Comment, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut table_id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut column_index__ = None;
let mut description__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::TableId => {
if table_id__.is_some() {
return Err(serde::de::Error::duplicate_field("tableId"));
}
table_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::ColumnIndex => {
if column_index__.is_some() {
return Err(serde::de::Error::duplicate_field("columnIndex"));
}
column_index__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::Description => {
if description__.is_some() {
return Err(serde::de::Error::duplicate_field("description"));
}
description__ = map_.next_value()?;
}
}
}
Ok(Comment {
table_id: table_id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
column_index: column_index__,
description: description__,
})
}
}
deserializer.deserialize_struct("catalog.Comment", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for Connection {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if self.info.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Connection", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if let Some(v) = self.info.as_ref() {
match v {
connection::Info::PrivateLinkService(v) => {
struct_ser.serialize_field("privateLinkService", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Connection {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"name",
"owner",
"private_link_service",
"privateLinkService",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
SchemaId,
DatabaseId,
Name,
Owner,
PrivateLinkService,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"owner" => Ok(GeneratedField::Owner),
"privateLinkService" | "private_link_service" => Ok(GeneratedField::PrivateLinkService),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Connection;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Connection")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Connection, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut owner__ = None;
let mut info__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::PrivateLinkService => {
if info__.is_some() {
return Err(serde::de::Error::duplicate_field("privateLinkService"));
}
info__ = map_.next_value::<::std::option::Option<_>>()?.map(connection::Info::PrivateLinkService)
;
}
}
}
Ok(Connection {
id: id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
info: info__,
})
}
}
deserializer.deserialize_struct("catalog.Connection", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for connection::PrivateLinkService {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.provider != 0 {
len += 1;
}
if !self.service_name.is_empty() {
len += 1;
}
if !self.endpoint_id.is_empty() {
len += 1;
}
if !self.dns_entries.is_empty() {
len += 1;
}
if !self.endpoint_dns_name.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Connection.PrivateLinkService", len)?;
if self.provider != 0 {
let v = connection::private_link_service::PrivateLinkProvider::try_from(self.provider)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.provider)))?;
struct_ser.serialize_field("provider", &v)?;
}
if !self.service_name.is_empty() {
struct_ser.serialize_field("serviceName", &self.service_name)?;
}
if !self.endpoint_id.is_empty() {
struct_ser.serialize_field("endpointId", &self.endpoint_id)?;
}
if !self.dns_entries.is_empty() {
struct_ser.serialize_field("dnsEntries", &self.dns_entries)?;
}
if !self.endpoint_dns_name.is_empty() {
struct_ser.serialize_field("endpointDnsName", &self.endpoint_dns_name)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for connection::PrivateLinkService {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"provider",
"service_name",
"serviceName",
"endpoint_id",
"endpointId",
"dns_entries",
"dnsEntries",
"endpoint_dns_name",
"endpointDnsName",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Provider,
ServiceName,
EndpointId,
DnsEntries,
EndpointDnsName,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"provider" => Ok(GeneratedField::Provider),
"serviceName" | "service_name" => Ok(GeneratedField::ServiceName),
"endpointId" | "endpoint_id" => Ok(GeneratedField::EndpointId),
"dnsEntries" | "dns_entries" => Ok(GeneratedField::DnsEntries),
"endpointDnsName" | "endpoint_dns_name" => Ok(GeneratedField::EndpointDnsName),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = connection::PrivateLinkService;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Connection.PrivateLinkService")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<connection::PrivateLinkService, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut provider__ = None;
let mut service_name__ = None;
let mut endpoint_id__ = None;
let mut dns_entries__ = None;
let mut endpoint_dns_name__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Provider => {
if provider__.is_some() {
return Err(serde::de::Error::duplicate_field("provider"));
}
provider__ = Some(map_.next_value::<connection::private_link_service::PrivateLinkProvider>()? as i32);
}
GeneratedField::ServiceName => {
if service_name__.is_some() {
return Err(serde::de::Error::duplicate_field("serviceName"));
}
service_name__ = Some(map_.next_value()?);
}
GeneratedField::EndpointId => {
if endpoint_id__.is_some() {
return Err(serde::de::Error::duplicate_field("endpointId"));
}
endpoint_id__ = Some(map_.next_value()?);
}
GeneratedField::DnsEntries => {
if dns_entries__.is_some() {
return Err(serde::de::Error::duplicate_field("dnsEntries"));
}
dns_entries__ = Some(
map_.next_value::<std::collections::HashMap<_, _>>()?
);
}
GeneratedField::EndpointDnsName => {
if endpoint_dns_name__.is_some() {
return Err(serde::de::Error::duplicate_field("endpointDnsName"));
}
endpoint_dns_name__ = Some(map_.next_value()?);
}
}
}
Ok(connection::PrivateLinkService {
provider: provider__.unwrap_or_default(),
service_name: service_name__.unwrap_or_default(),
endpoint_id: endpoint_id__.unwrap_or_default(),
dns_entries: dns_entries__.unwrap_or_default(),
endpoint_dns_name: endpoint_dns_name__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.Connection.PrivateLinkService", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for connection::private_link_service::PrivateLinkProvider {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "UNSPECIFIED",
Self::Mock => "MOCK",
Self::Aws => "AWS",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for connection::private_link_service::PrivateLinkProvider {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"UNSPECIFIED",
"MOCK",
"AWS",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = connection::private_link_service::PrivateLinkProvider;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"UNSPECIFIED" => Ok(connection::private_link_service::PrivateLinkProvider::Unspecified),
"MOCK" => Ok(connection::private_link_service::PrivateLinkProvider::Mock),
"AWS" => Ok(connection::private_link_service::PrivateLinkProvider::Aws),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for CreateType {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "CREATE_TYPE_UNSPECIFIED",
Self::Background => "CREATE_TYPE_BACKGROUND",
Self::Foreground => "CREATE_TYPE_FOREGROUND",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for CreateType {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"CREATE_TYPE_UNSPECIFIED",
"CREATE_TYPE_BACKGROUND",
"CREATE_TYPE_FOREGROUND",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = CreateType;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"CREATE_TYPE_UNSPECIFIED" => Ok(CreateType::Unspecified),
"CREATE_TYPE_BACKGROUND" => Ok(CreateType::Background),
"CREATE_TYPE_FOREGROUND" => Ok(CreateType::Foreground),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for Database {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Database", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Database {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"name",
"owner",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
Name,
Owner,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"name" => Ok(GeneratedField::Name),
"owner" => Ok(GeneratedField::Owner),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Database;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Database")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Database, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut name__ = None;
let mut owner__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(Database {
id: id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.Database", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for Function {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if !self.arg_names.is_empty() {
len += 1;
}
if !self.arg_types.is_empty() {
len += 1;
}
if self.return_type.is_some() {
len += 1;
}
if !self.language.is_empty() {
len += 1;
}
if self.link.is_some() {
len += 1;
}
if self.identifier.is_some() {
len += 1;
}
if self.body.is_some() {
len += 1;
}
if self.compressed_binary.is_some() {
len += 1;
}
if self.always_retry_on_network_error {
len += 1;
}
if self.runtime.is_some() {
len += 1;
}
if self.kind.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Function", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if !self.arg_names.is_empty() {
struct_ser.serialize_field("argNames", &self.arg_names)?;
}
if !self.arg_types.is_empty() {
struct_ser.serialize_field("argTypes", &self.arg_types)?;
}
if let Some(v) = self.return_type.as_ref() {
struct_ser.serialize_field("returnType", v)?;
}
if !self.language.is_empty() {
struct_ser.serialize_field("language", &self.language)?;
}
if let Some(v) = self.link.as_ref() {
struct_ser.serialize_field("link", v)?;
}
if let Some(v) = self.identifier.as_ref() {
struct_ser.serialize_field("identifier", v)?;
}
if let Some(v) = self.body.as_ref() {
struct_ser.serialize_field("body", v)?;
}
if let Some(v) = self.compressed_binary.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("compressedBinary", pbjson::private::base64::encode(&v).as_str())?;
}
if self.always_retry_on_network_error {
struct_ser.serialize_field("alwaysRetryOnNetworkError", &self.always_retry_on_network_error)?;
}
if let Some(v) = self.runtime.as_ref() {
struct_ser.serialize_field("runtime", v)?;
}
if let Some(v) = self.kind.as_ref() {
match v {
function::Kind::Scalar(v) => {
struct_ser.serialize_field("scalar", v)?;
}
function::Kind::Table(v) => {
struct_ser.serialize_field("table", v)?;
}
function::Kind::Aggregate(v) => {
struct_ser.serialize_field("aggregate", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Function {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"name",
"owner",
"arg_names",
"argNames",
"arg_types",
"argTypes",
"return_type",
"returnType",
"language",
"link",
"identifier",
"body",
"compressed_binary",
"compressedBinary",
"always_retry_on_network_error",
"alwaysRetryOnNetworkError",
"runtime",
"scalar",
"table",
"aggregate",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
SchemaId,
DatabaseId,
Name,
Owner,
ArgNames,
ArgTypes,
ReturnType,
Language,
Link,
Identifier,
Body,
CompressedBinary,
AlwaysRetryOnNetworkError,
Runtime,
Scalar,
Table,
Aggregate,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"owner" => Ok(GeneratedField::Owner),
"argNames" | "arg_names" => Ok(GeneratedField::ArgNames),
"argTypes" | "arg_types" => Ok(GeneratedField::ArgTypes),
"returnType" | "return_type" => Ok(GeneratedField::ReturnType),
"language" => Ok(GeneratedField::Language),
"link" => Ok(GeneratedField::Link),
"identifier" => Ok(GeneratedField::Identifier),
"body" => Ok(GeneratedField::Body),
"compressedBinary" | "compressed_binary" => Ok(GeneratedField::CompressedBinary),
"alwaysRetryOnNetworkError" | "always_retry_on_network_error" => Ok(GeneratedField::AlwaysRetryOnNetworkError),
"runtime" => Ok(GeneratedField::Runtime),
"scalar" => Ok(GeneratedField::Scalar),
"table" => Ok(GeneratedField::Table),
"aggregate" => Ok(GeneratedField::Aggregate),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Function;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Function")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Function, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut owner__ = None;
let mut arg_names__ = None;
let mut arg_types__ = None;
let mut return_type__ = None;
let mut language__ = None;
let mut link__ = None;
let mut identifier__ = None;
let mut body__ = None;
let mut compressed_binary__ = None;
let mut always_retry_on_network_error__ = None;
let mut runtime__ = None;
let mut kind__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::ArgNames => {
if arg_names__.is_some() {
return Err(serde::de::Error::duplicate_field("argNames"));
}
arg_names__ = Some(map_.next_value()?);
}
GeneratedField::ArgTypes => {
if arg_types__.is_some() {
return Err(serde::de::Error::duplicate_field("argTypes"));
}
arg_types__ = Some(map_.next_value()?);
}
GeneratedField::ReturnType => {
if return_type__.is_some() {
return Err(serde::de::Error::duplicate_field("returnType"));
}
return_type__ = map_.next_value()?;
}
GeneratedField::Language => {
if language__.is_some() {
return Err(serde::de::Error::duplicate_field("language"));
}
language__ = Some(map_.next_value()?);
}
GeneratedField::Link => {
if link__.is_some() {
return Err(serde::de::Error::duplicate_field("link"));
}
link__ = map_.next_value()?;
}
GeneratedField::Identifier => {
if identifier__.is_some() {
return Err(serde::de::Error::duplicate_field("identifier"));
}
identifier__ = map_.next_value()?;
}
GeneratedField::Body => {
if body__.is_some() {
return Err(serde::de::Error::duplicate_field("body"));
}
body__ = map_.next_value()?;
}
GeneratedField::CompressedBinary => {
if compressed_binary__.is_some() {
return Err(serde::de::Error::duplicate_field("compressedBinary"));
}
compressed_binary__ =
map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::AlwaysRetryOnNetworkError => {
if always_retry_on_network_error__.is_some() {
return Err(serde::de::Error::duplicate_field("alwaysRetryOnNetworkError"));
}
always_retry_on_network_error__ = Some(map_.next_value()?);
}
GeneratedField::Runtime => {
if runtime__.is_some() {
return Err(serde::de::Error::duplicate_field("runtime"));
}
runtime__ = map_.next_value()?;
}
GeneratedField::Scalar => {
if kind__.is_some() {
return Err(serde::de::Error::duplicate_field("scalar"));
}
kind__ = map_.next_value::<::std::option::Option<_>>()?.map(function::Kind::Scalar)
;
}
GeneratedField::Table => {
if kind__.is_some() {
return Err(serde::de::Error::duplicate_field("table"));
}
kind__ = map_.next_value::<::std::option::Option<_>>()?.map(function::Kind::Table)
;
}
GeneratedField::Aggregate => {
if kind__.is_some() {
return Err(serde::de::Error::duplicate_field("aggregate"));
}
kind__ = map_.next_value::<::std::option::Option<_>>()?.map(function::Kind::Aggregate)
;
}
}
}
Ok(Function {
id: id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
arg_names: arg_names__.unwrap_or_default(),
arg_types: arg_types__.unwrap_or_default(),
return_type: return_type__,
language: language__.unwrap_or_default(),
link: link__,
identifier: identifier__,
body: body__,
compressed_binary: compressed_binary__,
always_retry_on_network_error: always_retry_on_network_error__.unwrap_or_default(),
runtime: runtime__,
kind: kind__,
})
}
}
deserializer.deserialize_struct("catalog.Function", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for function::AggregateFunction {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("catalog.Function.AggregateFunction", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for function::AggregateFunction {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = function::AggregateFunction;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Function.AggregateFunction")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<function::AggregateFunction, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(function::AggregateFunction {
})
}
}
deserializer.deserialize_struct("catalog.Function.AggregateFunction", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for function::ScalarFunction {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("catalog.Function.ScalarFunction", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for function::ScalarFunction {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = function::ScalarFunction;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Function.ScalarFunction")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<function::ScalarFunction, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(function::ScalarFunction {
})
}
}
deserializer.deserialize_struct("catalog.Function.ScalarFunction", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for function::TableFunction {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("catalog.Function.TableFunction", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for function::TableFunction {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = function::TableFunction;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Function.TableFunction")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<function::TableFunction, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(function::TableFunction {
})
}
}
deserializer.deserialize_struct("catalog.Function.TableFunction", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for HandleConflictBehavior {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "HANDLE_CONFLICT_BEHAVIOR_UNSPECIFIED",
Self::Overwrite => "HANDLE_CONFLICT_BEHAVIOR_OVERWRITE",
Self::Ignore => "HANDLE_CONFLICT_BEHAVIOR_IGNORE",
Self::NoCheck => "HANDLE_CONFLICT_BEHAVIOR_NO_CHECK",
Self::DoUpdateIfNotNull => "HANDLE_CONFLICT_BEHAVIOR_DO_UPDATE_IF_NOT_NULL",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for HandleConflictBehavior {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"HANDLE_CONFLICT_BEHAVIOR_UNSPECIFIED",
"HANDLE_CONFLICT_BEHAVIOR_OVERWRITE",
"HANDLE_CONFLICT_BEHAVIOR_IGNORE",
"HANDLE_CONFLICT_BEHAVIOR_NO_CHECK",
"HANDLE_CONFLICT_BEHAVIOR_DO_UPDATE_IF_NOT_NULL",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = HandleConflictBehavior;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"HANDLE_CONFLICT_BEHAVIOR_UNSPECIFIED" => Ok(HandleConflictBehavior::Unspecified),
"HANDLE_CONFLICT_BEHAVIOR_OVERWRITE" => Ok(HandleConflictBehavior::Overwrite),
"HANDLE_CONFLICT_BEHAVIOR_IGNORE" => Ok(HandleConflictBehavior::Ignore),
"HANDLE_CONFLICT_BEHAVIOR_NO_CHECK" => Ok(HandleConflictBehavior::NoCheck),
"HANDLE_CONFLICT_BEHAVIOR_DO_UPDATE_IF_NOT_NULL" => Ok(HandleConflictBehavior::DoUpdateIfNotNull),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for Index {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if self.index_table_id != 0 {
len += 1;
}
if self.primary_table_id != 0 {
len += 1;
}
if !self.index_item.is_empty() {
len += 1;
}
if !self.index_column_properties.is_empty() {
len += 1;
}
if self.initialized_at_epoch.is_some() {
len += 1;
}
if self.created_at_epoch.is_some() {
len += 1;
}
if self.stream_job_status != 0 {
len += 1;
}
if self.index_columns_len != 0 {
len += 1;
}
if self.initialized_at_cluster_version.is_some() {
len += 1;
}
if self.created_at_cluster_version.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Index", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if self.index_table_id != 0 {
struct_ser.serialize_field("indexTableId", &self.index_table_id)?;
}
if self.primary_table_id != 0 {
struct_ser.serialize_field("primaryTableId", &self.primary_table_id)?;
}
if !self.index_item.is_empty() {
struct_ser.serialize_field("indexItem", &self.index_item)?;
}
if !self.index_column_properties.is_empty() {
struct_ser.serialize_field("indexColumnProperties", &self.index_column_properties)?;
}
if let Some(v) = self.initialized_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
}
if let Some(v) = self.created_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
}
if self.stream_job_status != 0 {
let v = StreamJobStatus::try_from(self.stream_job_status)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.stream_job_status)))?;
struct_ser.serialize_field("streamJobStatus", &v)?;
}
if self.index_columns_len != 0 {
struct_ser.serialize_field("indexColumnsLen", &self.index_columns_len)?;
}
if let Some(v) = self.initialized_at_cluster_version.as_ref() {
struct_ser.serialize_field("initializedAtClusterVersion", v)?;
}
if let Some(v) = self.created_at_cluster_version.as_ref() {
struct_ser.serialize_field("createdAtClusterVersion", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Index {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"name",
"owner",
"index_table_id",
"indexTableId",
"primary_table_id",
"primaryTableId",
"index_item",
"indexItem",
"index_column_properties",
"indexColumnProperties",
"initialized_at_epoch",
"initializedAtEpoch",
"created_at_epoch",
"createdAtEpoch",
"stream_job_status",
"streamJobStatus",
"index_columns_len",
"indexColumnsLen",
"initialized_at_cluster_version",
"initializedAtClusterVersion",
"created_at_cluster_version",
"createdAtClusterVersion",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
SchemaId,
DatabaseId,
Name,
Owner,
IndexTableId,
PrimaryTableId,
IndexItem,
IndexColumnProperties,
InitializedAtEpoch,
CreatedAtEpoch,
StreamJobStatus,
IndexColumnsLen,
InitializedAtClusterVersion,
CreatedAtClusterVersion,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"owner" => Ok(GeneratedField::Owner),
"indexTableId" | "index_table_id" => Ok(GeneratedField::IndexTableId),
"primaryTableId" | "primary_table_id" => Ok(GeneratedField::PrimaryTableId),
"indexItem" | "index_item" => Ok(GeneratedField::IndexItem),
"indexColumnProperties" | "index_column_properties" => Ok(GeneratedField::IndexColumnProperties),
"initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
"createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
"streamJobStatus" | "stream_job_status" => Ok(GeneratedField::StreamJobStatus),
"indexColumnsLen" | "index_columns_len" => Ok(GeneratedField::IndexColumnsLen),
"initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
"createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Index;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Index")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Index, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut owner__ = None;
let mut index_table_id__ = None;
let mut primary_table_id__ = None;
let mut index_item__ = None;
let mut index_column_properties__ = None;
let mut initialized_at_epoch__ = None;
let mut created_at_epoch__ = None;
let mut stream_job_status__ = None;
let mut index_columns_len__ = None;
let mut initialized_at_cluster_version__ = None;
let mut created_at_cluster_version__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::IndexTableId => {
if index_table_id__.is_some() {
return Err(serde::de::Error::duplicate_field("indexTableId"));
}
index_table_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::PrimaryTableId => {
if primary_table_id__.is_some() {
return Err(serde::de::Error::duplicate_field("primaryTableId"));
}
primary_table_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::IndexItem => {
if index_item__.is_some() {
return Err(serde::de::Error::duplicate_field("indexItem"));
}
index_item__ = Some(map_.next_value()?);
}
GeneratedField::IndexColumnProperties => {
if index_column_properties__.is_some() {
return Err(serde::de::Error::duplicate_field("indexColumnProperties"));
}
index_column_properties__ = Some(map_.next_value()?);
}
GeneratedField::InitializedAtEpoch => {
if initialized_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
}
initialized_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::CreatedAtEpoch => {
if created_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
}
created_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::StreamJobStatus => {
if stream_job_status__.is_some() {
return Err(serde::de::Error::duplicate_field("streamJobStatus"));
}
stream_job_status__ = Some(map_.next_value::<StreamJobStatus>()? as i32);
}
GeneratedField::IndexColumnsLen => {
if index_columns_len__.is_some() {
return Err(serde::de::Error::duplicate_field("indexColumnsLen"));
}
index_columns_len__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::InitializedAtClusterVersion => {
if initialized_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
}
initialized_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::CreatedAtClusterVersion => {
if created_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
}
created_at_cluster_version__ = map_.next_value()?;
}
}
}
Ok(Index {
id: id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
index_table_id: index_table_id__.unwrap_or_default(),
primary_table_id: primary_table_id__.unwrap_or_default(),
index_item: index_item__.unwrap_or_default(),
index_column_properties: index_column_properties__.unwrap_or_default(),
initialized_at_epoch: initialized_at_epoch__,
created_at_epoch: created_at_epoch__,
stream_job_status: stream_job_status__.unwrap_or_default(),
index_columns_len: index_columns_len__.unwrap_or_default(),
initialized_at_cluster_version: initialized_at_cluster_version__,
created_at_cluster_version: created_at_cluster_version__,
})
}
}
deserializer.deserialize_struct("catalog.Index", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for IndexColumnProperties {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.is_desc {
len += 1;
}
if self.nulls_first {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.IndexColumnProperties", len)?;
if self.is_desc {
struct_ser.serialize_field("isDesc", &self.is_desc)?;
}
if self.nulls_first {
struct_ser.serialize_field("nullsFirst", &self.nulls_first)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for IndexColumnProperties {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"is_desc",
"isDesc",
"nulls_first",
"nullsFirst",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
IsDesc,
NullsFirst,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"isDesc" | "is_desc" => Ok(GeneratedField::IsDesc),
"nullsFirst" | "nulls_first" => Ok(GeneratedField::NullsFirst),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = IndexColumnProperties;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.IndexColumnProperties")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<IndexColumnProperties, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut is_desc__ = None;
let mut nulls_first__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::IsDesc => {
if is_desc__.is_some() {
return Err(serde::de::Error::duplicate_field("isDesc"));
}
is_desc__ = Some(map_.next_value()?);
}
GeneratedField::NullsFirst => {
if nulls_first__.is_some() {
return Err(serde::de::Error::duplicate_field("nullsFirst"));
}
nulls_first__ = Some(map_.next_value()?);
}
}
}
Ok(IndexColumnProperties {
is_desc: is_desc__.unwrap_or_default(),
nulls_first: nulls_first__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.IndexColumnProperties", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for OptionsWithSecret {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if !self.options.is_empty() {
len += 1;
}
if !self.secret_refs.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.OptionsWithSecret", len)?;
if !self.options.is_empty() {
struct_ser.serialize_field("options", &self.options)?;
}
if !self.secret_refs.is_empty() {
struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for OptionsWithSecret {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"options",
"secret_refs",
"secretRefs",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Options,
SecretRefs,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"options" => Ok(GeneratedField::Options),
"secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = OptionsWithSecret;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.OptionsWithSecret")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<OptionsWithSecret, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut options__ = None;
let mut secret_refs__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Options => {
if options__.is_some() {
return Err(serde::de::Error::duplicate_field("options"));
}
options__ = Some(
map_.next_value::<std::collections::HashMap<_, _>>()?
);
}
GeneratedField::SecretRefs => {
if secret_refs__.is_some() {
return Err(serde::de::Error::duplicate_field("secretRefs"));
}
secret_refs__ = Some(
map_.next_value::<std::collections::HashMap<_, _>>()?
);
}
}
}
Ok(OptionsWithSecret {
options: options__.unwrap_or_default(),
secret_refs: secret_refs__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.OptionsWithSecret", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for Schema {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Schema", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Schema {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"database_id",
"databaseId",
"name",
"owner",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
DatabaseId,
Name,
Owner,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"owner" => Ok(GeneratedField::Owner),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Schema;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Schema")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Schema, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut owner__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(Schema {
id: id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.Schema", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SchemaRegistryNameStrategy {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "SCHEMA_REGISTRY_NAME_STRATEGY_UNSPECIFIED",
Self::RecordNameStrategy => "SCHEMA_REGISTRY_NAME_STRATEGY_RECORD_NAME_STRATEGY",
Self::TopicRecordNameStrategy => "SCHEMA_REGISTRY_NAME_STRATEGY_TOPIC_RECORD_NAME_STRATEGY",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for SchemaRegistryNameStrategy {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"SCHEMA_REGISTRY_NAME_STRATEGY_UNSPECIFIED",
"SCHEMA_REGISTRY_NAME_STRATEGY_RECORD_NAME_STRATEGY",
"SCHEMA_REGISTRY_NAME_STRATEGY_TOPIC_RECORD_NAME_STRATEGY",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SchemaRegistryNameStrategy;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"SCHEMA_REGISTRY_NAME_STRATEGY_UNSPECIFIED" => Ok(SchemaRegistryNameStrategy::Unspecified),
"SCHEMA_REGISTRY_NAME_STRATEGY_RECORD_NAME_STRATEGY" => Ok(SchemaRegistryNameStrategy::RecordNameStrategy),
"SCHEMA_REGISTRY_NAME_STRATEGY_TOPIC_RECORD_NAME_STRATEGY" => Ok(SchemaRegistryNameStrategy::TopicRecordNameStrategy),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for Secret {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.value.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Secret", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.value.is_empty() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("value", pbjson::private::base64::encode(&self.value).as_str())?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Secret {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"name",
"database_id",
"databaseId",
"value",
"owner",
"schema_id",
"schemaId",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
Name,
DatabaseId,
Value,
Owner,
SchemaId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"name" => Ok(GeneratedField::Name),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"value" => Ok(GeneratedField::Value),
"owner" => Ok(GeneratedField::Owner),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Secret;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Secret")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Secret, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut name__ = None;
let mut database_id__ = None;
let mut value__ = None;
let mut owner__ = None;
let mut schema_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Value => {
if value__.is_some() {
return Err(serde::de::Error::duplicate_field("value"));
}
value__ =
Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
;
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(Secret {
id: id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
value: value__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.Secret", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for Sink {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if !self.columns.is_empty() {
len += 1;
}
if !self.plan_pk.is_empty() {
len += 1;
}
if !self.dependent_relations.is_empty() {
len += 1;
}
if !self.distribution_key.is_empty() {
len += 1;
}
if !self.downstream_pk.is_empty() {
len += 1;
}
if self.sink_type != 0 {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if !self.properties.is_empty() {
len += 1;
}
if !self.definition.is_empty() {
len += 1;
}
if self.connection_id.is_some() {
len += 1;
}
if self.initialized_at_epoch.is_some() {
len += 1;
}
if self.created_at_epoch.is_some() {
len += 1;
}
if !self.db_name.is_empty() {
len += 1;
}
if !self.sink_from_name.is_empty() {
len += 1;
}
if self.stream_job_status != 0 {
len += 1;
}
if self.format_desc.is_some() {
len += 1;
}
if self.target_table.is_some() {
len += 1;
}
if self.initialized_at_cluster_version.is_some() {
len += 1;
}
if self.created_at_cluster_version.is_some() {
len += 1;
}
if self.create_type != 0 {
len += 1;
}
if !self.secret_refs.is_empty() {
len += 1;
}
if !self.original_target_columns.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Sink", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if !self.columns.is_empty() {
struct_ser.serialize_field("columns", &self.columns)?;
}
if !self.plan_pk.is_empty() {
struct_ser.serialize_field("planPk", &self.plan_pk)?;
}
if !self.dependent_relations.is_empty() {
struct_ser.serialize_field("dependentRelations", &self.dependent_relations)?;
}
if !self.distribution_key.is_empty() {
struct_ser.serialize_field("distributionKey", &self.distribution_key)?;
}
if !self.downstream_pk.is_empty() {
struct_ser.serialize_field("downstreamPk", &self.downstream_pk)?;
}
if self.sink_type != 0 {
let v = SinkType::try_from(self.sink_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.sink_type)))?;
struct_ser.serialize_field("sinkType", &v)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if !self.properties.is_empty() {
struct_ser.serialize_field("properties", &self.properties)?;
}
if !self.definition.is_empty() {
struct_ser.serialize_field("definition", &self.definition)?;
}
if let Some(v) = self.connection_id.as_ref() {
struct_ser.serialize_field("connectionId", v)?;
}
if let Some(v) = self.initialized_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
}
if let Some(v) = self.created_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
}
if !self.db_name.is_empty() {
struct_ser.serialize_field("dbName", &self.db_name)?;
}
if !self.sink_from_name.is_empty() {
struct_ser.serialize_field("sinkFromName", &self.sink_from_name)?;
}
if self.stream_job_status != 0 {
let v = StreamJobStatus::try_from(self.stream_job_status)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.stream_job_status)))?;
struct_ser.serialize_field("streamJobStatus", &v)?;
}
if let Some(v) = self.format_desc.as_ref() {
struct_ser.serialize_field("formatDesc", v)?;
}
if let Some(v) = self.target_table.as_ref() {
struct_ser.serialize_field("targetTable", v)?;
}
if let Some(v) = self.initialized_at_cluster_version.as_ref() {
struct_ser.serialize_field("initializedAtClusterVersion", v)?;
}
if let Some(v) = self.created_at_cluster_version.as_ref() {
struct_ser.serialize_field("createdAtClusterVersion", v)?;
}
if self.create_type != 0 {
let v = CreateType::try_from(self.create_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.create_type)))?;
struct_ser.serialize_field("createType", &v)?;
}
if !self.secret_refs.is_empty() {
struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
}
if !self.original_target_columns.is_empty() {
struct_ser.serialize_field("originalTargetColumns", &self.original_target_columns)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Sink {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"name",
"columns",
"plan_pk",
"planPk",
"dependent_relations",
"dependentRelations",
"distribution_key",
"distributionKey",
"downstream_pk",
"downstreamPk",
"sink_type",
"sinkType",
"owner",
"properties",
"definition",
"connection_id",
"connectionId",
"initialized_at_epoch",
"initializedAtEpoch",
"created_at_epoch",
"createdAtEpoch",
"db_name",
"dbName",
"sink_from_name",
"sinkFromName",
"stream_job_status",
"streamJobStatus",
"format_desc",
"formatDesc",
"target_table",
"targetTable",
"initialized_at_cluster_version",
"initializedAtClusterVersion",
"created_at_cluster_version",
"createdAtClusterVersion",
"create_type",
"createType",
"secret_refs",
"secretRefs",
"original_target_columns",
"originalTargetColumns",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
SchemaId,
DatabaseId,
Name,
Columns,
PlanPk,
DependentRelations,
DistributionKey,
DownstreamPk,
SinkType,
Owner,
Properties,
Definition,
ConnectionId,
InitializedAtEpoch,
CreatedAtEpoch,
DbName,
SinkFromName,
StreamJobStatus,
FormatDesc,
TargetTable,
InitializedAtClusterVersion,
CreatedAtClusterVersion,
CreateType,
SecretRefs,
OriginalTargetColumns,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"columns" => Ok(GeneratedField::Columns),
"planPk" | "plan_pk" => Ok(GeneratedField::PlanPk),
"dependentRelations" | "dependent_relations" => Ok(GeneratedField::DependentRelations),
"distributionKey" | "distribution_key" => Ok(GeneratedField::DistributionKey),
"downstreamPk" | "downstream_pk" => Ok(GeneratedField::DownstreamPk),
"sinkType" | "sink_type" => Ok(GeneratedField::SinkType),
"owner" => Ok(GeneratedField::Owner),
"properties" => Ok(GeneratedField::Properties),
"definition" => Ok(GeneratedField::Definition),
"connectionId" | "connection_id" => Ok(GeneratedField::ConnectionId),
"initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
"createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
"dbName" | "db_name" => Ok(GeneratedField::DbName),
"sinkFromName" | "sink_from_name" => Ok(GeneratedField::SinkFromName),
"streamJobStatus" | "stream_job_status" => Ok(GeneratedField::StreamJobStatus),
"formatDesc" | "format_desc" => Ok(GeneratedField::FormatDesc),
"targetTable" | "target_table" => Ok(GeneratedField::TargetTable),
"initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
"createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
"createType" | "create_type" => Ok(GeneratedField::CreateType),
"secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
"originalTargetColumns" | "original_target_columns" => Ok(GeneratedField::OriginalTargetColumns),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Sink;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Sink")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Sink, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut columns__ = None;
let mut plan_pk__ = None;
let mut dependent_relations__ = None;
let mut distribution_key__ = None;
let mut downstream_pk__ = None;
let mut sink_type__ = None;
let mut owner__ = None;
let mut properties__ = None;
let mut definition__ = None;
let mut connection_id__ = None;
let mut initialized_at_epoch__ = None;
let mut created_at_epoch__ = None;
let mut db_name__ = None;
let mut sink_from_name__ = None;
let mut stream_job_status__ = None;
let mut format_desc__ = None;
let mut target_table__ = None;
let mut initialized_at_cluster_version__ = None;
let mut created_at_cluster_version__ = None;
let mut create_type__ = None;
let mut secret_refs__ = None;
let mut original_target_columns__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Columns => {
if columns__.is_some() {
return Err(serde::de::Error::duplicate_field("columns"));
}
columns__ = Some(map_.next_value()?);
}
GeneratedField::PlanPk => {
if plan_pk__.is_some() {
return Err(serde::de::Error::duplicate_field("planPk"));
}
plan_pk__ = Some(map_.next_value()?);
}
GeneratedField::DependentRelations => {
if dependent_relations__.is_some() {
return Err(serde::de::Error::duplicate_field("dependentRelations"));
}
dependent_relations__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::DistributionKey => {
if distribution_key__.is_some() {
return Err(serde::de::Error::duplicate_field("distributionKey"));
}
distribution_key__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::DownstreamPk => {
if downstream_pk__.is_some() {
return Err(serde::de::Error::duplicate_field("downstreamPk"));
}
downstream_pk__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::SinkType => {
if sink_type__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkType"));
}
sink_type__ = Some(map_.next_value::<SinkType>()? as i32);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Properties => {
if properties__.is_some() {
return Err(serde::de::Error::duplicate_field("properties"));
}
properties__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::Definition => {
if definition__.is_some() {
return Err(serde::de::Error::duplicate_field("definition"));
}
definition__ = Some(map_.next_value()?);
}
GeneratedField::ConnectionId => {
if connection_id__.is_some() {
return Err(serde::de::Error::duplicate_field("connectionId"));
}
connection_id__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::InitializedAtEpoch => {
if initialized_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
}
initialized_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::CreatedAtEpoch => {
if created_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
}
created_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::DbName => {
if db_name__.is_some() {
return Err(serde::de::Error::duplicate_field("dbName"));
}
db_name__ = Some(map_.next_value()?);
}
GeneratedField::SinkFromName => {
if sink_from_name__.is_some() {
return Err(serde::de::Error::duplicate_field("sinkFromName"));
}
sink_from_name__ = Some(map_.next_value()?);
}
GeneratedField::StreamJobStatus => {
if stream_job_status__.is_some() {
return Err(serde::de::Error::duplicate_field("streamJobStatus"));
}
stream_job_status__ = Some(map_.next_value::<StreamJobStatus>()? as i32);
}
GeneratedField::FormatDesc => {
if format_desc__.is_some() {
return Err(serde::de::Error::duplicate_field("formatDesc"));
}
format_desc__ = map_.next_value()?;
}
GeneratedField::TargetTable => {
if target_table__.is_some() {
return Err(serde::de::Error::duplicate_field("targetTable"));
}
target_table__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::InitializedAtClusterVersion => {
if initialized_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
}
initialized_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::CreatedAtClusterVersion => {
if created_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
}
created_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::CreateType => {
if create_type__.is_some() {
return Err(serde::de::Error::duplicate_field("createType"));
}
create_type__ = Some(map_.next_value::<CreateType>()? as i32);
}
GeneratedField::SecretRefs => {
if secret_refs__.is_some() {
return Err(serde::de::Error::duplicate_field("secretRefs"));
}
secret_refs__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::OriginalTargetColumns => {
if original_target_columns__.is_some() {
return Err(serde::de::Error::duplicate_field("originalTargetColumns"));
}
original_target_columns__ = Some(map_.next_value()?);
}
}
}
Ok(Sink {
id: id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
columns: columns__.unwrap_or_default(),
plan_pk: plan_pk__.unwrap_or_default(),
dependent_relations: dependent_relations__.unwrap_or_default(),
distribution_key: distribution_key__.unwrap_or_default(),
downstream_pk: downstream_pk__.unwrap_or_default(),
sink_type: sink_type__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
properties: properties__.unwrap_or_default(),
definition: definition__.unwrap_or_default(),
connection_id: connection_id__,
initialized_at_epoch: initialized_at_epoch__,
created_at_epoch: created_at_epoch__,
db_name: db_name__.unwrap_or_default(),
sink_from_name: sink_from_name__.unwrap_or_default(),
stream_job_status: stream_job_status__.unwrap_or_default(),
format_desc: format_desc__,
target_table: target_table__,
initialized_at_cluster_version: initialized_at_cluster_version__,
created_at_cluster_version: created_at_cluster_version__,
create_type: create_type__.unwrap_or_default(),
secret_refs: secret_refs__.unwrap_or_default(),
original_target_columns: original_target_columns__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.Sink", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkFormatDesc {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.format != 0 {
len += 1;
}
if self.encode != 0 {
len += 1;
}
if !self.options.is_empty() {
len += 1;
}
if self.key_encode.is_some() {
len += 1;
}
if !self.secret_refs.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.SinkFormatDesc", len)?;
if self.format != 0 {
let v = super::plan_common::FormatType::try_from(self.format)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.format)))?;
struct_ser.serialize_field("format", &v)?;
}
if self.encode != 0 {
let v = super::plan_common::EncodeType::try_from(self.encode)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.encode)))?;
struct_ser.serialize_field("encode", &v)?;
}
if !self.options.is_empty() {
struct_ser.serialize_field("options", &self.options)?;
}
if let Some(v) = self.key_encode.as_ref() {
let v = super::plan_common::EncodeType::try_from(*v)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
struct_ser.serialize_field("keyEncode", &v)?;
}
if !self.secret_refs.is_empty() {
struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SinkFormatDesc {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"format",
"encode",
"options",
"key_encode",
"keyEncode",
"secret_refs",
"secretRefs",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Format,
Encode,
Options,
KeyEncode,
SecretRefs,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"format" => Ok(GeneratedField::Format),
"encode" => Ok(GeneratedField::Encode),
"options" => Ok(GeneratedField::Options),
"keyEncode" | "key_encode" => Ok(GeneratedField::KeyEncode),
"secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkFormatDesc;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.SinkFormatDesc")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkFormatDesc, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut format__ = None;
let mut encode__ = None;
let mut options__ = None;
let mut key_encode__ = None;
let mut secret_refs__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Format => {
if format__.is_some() {
return Err(serde::de::Error::duplicate_field("format"));
}
format__ = Some(map_.next_value::<super::plan_common::FormatType>()? as i32);
}
GeneratedField::Encode => {
if encode__.is_some() {
return Err(serde::de::Error::duplicate_field("encode"));
}
encode__ = Some(map_.next_value::<super::plan_common::EncodeType>()? as i32);
}
GeneratedField::Options => {
if options__.is_some() {
return Err(serde::de::Error::duplicate_field("options"));
}
options__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::KeyEncode => {
if key_encode__.is_some() {
return Err(serde::de::Error::duplicate_field("keyEncode"));
}
key_encode__ = map_.next_value::<::std::option::Option<super::plan_common::EncodeType>>()?.map(|x| x as i32);
}
GeneratedField::SecretRefs => {
if secret_refs__.is_some() {
return Err(serde::de::Error::duplicate_field("secretRefs"));
}
secret_refs__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
}
}
Ok(SinkFormatDesc {
format: format__.unwrap_or_default(),
encode: encode__.unwrap_or_default(),
options: options__.unwrap_or_default(),
key_encode: key_encode__,
secret_refs: secret_refs__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.SinkFormatDesc", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SinkType {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "SINK_TYPE_UNSPECIFIED",
Self::AppendOnly => "SINK_TYPE_APPEND_ONLY",
Self::ForceAppendOnly => "SINK_TYPE_FORCE_APPEND_ONLY",
Self::Upsert => "SINK_TYPE_UPSERT",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for SinkType {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"SINK_TYPE_UNSPECIFIED",
"SINK_TYPE_APPEND_ONLY",
"SINK_TYPE_FORCE_APPEND_ONLY",
"SINK_TYPE_UPSERT",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SinkType;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"SINK_TYPE_UNSPECIFIED" => Ok(SinkType::Unspecified),
"SINK_TYPE_APPEND_ONLY" => Ok(SinkType::AppendOnly),
"SINK_TYPE_FORCE_APPEND_ONLY" => Ok(SinkType::ForceAppendOnly),
"SINK_TYPE_UPSERT" => Ok(SinkType::Upsert),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for Source {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.row_id_index.is_some() {
len += 1;
}
if !self.columns.is_empty() {
len += 1;
}
if !self.pk_column_ids.is_empty() {
len += 1;
}
if !self.with_properties.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if self.info.is_some() {
len += 1;
}
if !self.watermark_descs.is_empty() {
len += 1;
}
if !self.definition.is_empty() {
len += 1;
}
if self.connection_id.is_some() {
len += 1;
}
if self.initialized_at_epoch.is_some() {
len += 1;
}
if self.created_at_epoch.is_some() {
len += 1;
}
if self.initialized_at_cluster_version.is_some() {
len += 1;
}
if self.created_at_cluster_version.is_some() {
len += 1;
}
if !self.secret_refs.is_empty() {
len += 1;
}
if self.version != 0 {
len += 1;
}
if self.rate_limit.is_some() {
len += 1;
}
if self.optional_associated_table_id.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Source", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if let Some(v) = self.row_id_index.as_ref() {
struct_ser.serialize_field("rowIdIndex", v)?;
}
if !self.columns.is_empty() {
struct_ser.serialize_field("columns", &self.columns)?;
}
if !self.pk_column_ids.is_empty() {
struct_ser.serialize_field("pkColumnIds", &self.pk_column_ids)?;
}
if !self.with_properties.is_empty() {
struct_ser.serialize_field("withProperties", &self.with_properties)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if let Some(v) = self.info.as_ref() {
struct_ser.serialize_field("info", v)?;
}
if !self.watermark_descs.is_empty() {
struct_ser.serialize_field("watermarkDescs", &self.watermark_descs)?;
}
if !self.definition.is_empty() {
struct_ser.serialize_field("definition", &self.definition)?;
}
if let Some(v) = self.connection_id.as_ref() {
struct_ser.serialize_field("connectionId", v)?;
}
if let Some(v) = self.initialized_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
}
if let Some(v) = self.created_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
}
if let Some(v) = self.initialized_at_cluster_version.as_ref() {
struct_ser.serialize_field("initializedAtClusterVersion", v)?;
}
if let Some(v) = self.created_at_cluster_version.as_ref() {
struct_ser.serialize_field("createdAtClusterVersion", v)?;
}
if !self.secret_refs.is_empty() {
struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
}
if self.version != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
}
if let Some(v) = self.rate_limit.as_ref() {
struct_ser.serialize_field("rateLimit", v)?;
}
if let Some(v) = self.optional_associated_table_id.as_ref() {
match v {
source::OptionalAssociatedTableId::AssociatedTableId(v) => {
struct_ser.serialize_field("associatedTableId", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Source {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"name",
"row_id_index",
"rowIdIndex",
"columns",
"pk_column_ids",
"pkColumnIds",
"with_properties",
"withProperties",
"owner",
"info",
"watermark_descs",
"watermarkDescs",
"definition",
"connection_id",
"connectionId",
"initialized_at_epoch",
"initializedAtEpoch",
"created_at_epoch",
"createdAtEpoch",
"initialized_at_cluster_version",
"initializedAtClusterVersion",
"created_at_cluster_version",
"createdAtClusterVersion",
"secret_refs",
"secretRefs",
"version",
"rate_limit",
"rateLimit",
"associated_table_id",
"associatedTableId",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
SchemaId,
DatabaseId,
Name,
RowIdIndex,
Columns,
PkColumnIds,
WithProperties,
Owner,
Info,
WatermarkDescs,
Definition,
ConnectionId,
InitializedAtEpoch,
CreatedAtEpoch,
InitializedAtClusterVersion,
CreatedAtClusterVersion,
SecretRefs,
Version,
RateLimit,
AssociatedTableId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"rowIdIndex" | "row_id_index" => Ok(GeneratedField::RowIdIndex),
"columns" => Ok(GeneratedField::Columns),
"pkColumnIds" | "pk_column_ids" => Ok(GeneratedField::PkColumnIds),
"withProperties" | "with_properties" => Ok(GeneratedField::WithProperties),
"owner" => Ok(GeneratedField::Owner),
"info" => Ok(GeneratedField::Info),
"watermarkDescs" | "watermark_descs" => Ok(GeneratedField::WatermarkDescs),
"definition" => Ok(GeneratedField::Definition),
"connectionId" | "connection_id" => Ok(GeneratedField::ConnectionId),
"initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
"createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
"initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
"createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
"secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
"version" => Ok(GeneratedField::Version),
"rateLimit" | "rate_limit" => Ok(GeneratedField::RateLimit),
"associatedTableId" | "associated_table_id" => Ok(GeneratedField::AssociatedTableId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Source;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Source")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Source, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut row_id_index__ = None;
let mut columns__ = None;
let mut pk_column_ids__ = None;
let mut with_properties__ = None;
let mut owner__ = None;
let mut info__ = None;
let mut watermark_descs__ = None;
let mut definition__ = None;
let mut connection_id__ = None;
let mut initialized_at_epoch__ = None;
let mut created_at_epoch__ = None;
let mut initialized_at_cluster_version__ = None;
let mut created_at_cluster_version__ = None;
let mut secret_refs__ = None;
let mut version__ = None;
let mut rate_limit__ = None;
let mut optional_associated_table_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::RowIdIndex => {
if row_id_index__.is_some() {
return Err(serde::de::Error::duplicate_field("rowIdIndex"));
}
row_id_index__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::Columns => {
if columns__.is_some() {
return Err(serde::de::Error::duplicate_field("columns"));
}
columns__ = Some(map_.next_value()?);
}
GeneratedField::PkColumnIds => {
if pk_column_ids__.is_some() {
return Err(serde::de::Error::duplicate_field("pkColumnIds"));
}
pk_column_ids__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::WithProperties => {
if with_properties__.is_some() {
return Err(serde::de::Error::duplicate_field("withProperties"));
}
with_properties__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Info => {
if info__.is_some() {
return Err(serde::de::Error::duplicate_field("info"));
}
info__ = map_.next_value()?;
}
GeneratedField::WatermarkDescs => {
if watermark_descs__.is_some() {
return Err(serde::de::Error::duplicate_field("watermarkDescs"));
}
watermark_descs__ = Some(map_.next_value()?);
}
GeneratedField::Definition => {
if definition__.is_some() {
return Err(serde::de::Error::duplicate_field("definition"));
}
definition__ = Some(map_.next_value()?);
}
GeneratedField::ConnectionId => {
if connection_id__.is_some() {
return Err(serde::de::Error::duplicate_field("connectionId"));
}
connection_id__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::InitializedAtEpoch => {
if initialized_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
}
initialized_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::CreatedAtEpoch => {
if created_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
}
created_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::InitializedAtClusterVersion => {
if initialized_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
}
initialized_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::CreatedAtClusterVersion => {
if created_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
}
created_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::SecretRefs => {
if secret_refs__.is_some() {
return Err(serde::de::Error::duplicate_field("secretRefs"));
}
secret_refs__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::Version => {
if version__.is_some() {
return Err(serde::de::Error::duplicate_field("version"));
}
version__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::RateLimit => {
if rate_limit__.is_some() {
return Err(serde::de::Error::duplicate_field("rateLimit"));
}
rate_limit__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::AssociatedTableId => {
if optional_associated_table_id__.is_some() {
return Err(serde::de::Error::duplicate_field("associatedTableId"));
}
optional_associated_table_id__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| source::OptionalAssociatedTableId::AssociatedTableId(x.0));
}
}
}
Ok(Source {
id: id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
row_id_index: row_id_index__,
columns: columns__.unwrap_or_default(),
pk_column_ids: pk_column_ids__.unwrap_or_default(),
with_properties: with_properties__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
info: info__,
watermark_descs: watermark_descs__.unwrap_or_default(),
definition: definition__.unwrap_or_default(),
connection_id: connection_id__,
initialized_at_epoch: initialized_at_epoch__,
created_at_epoch: created_at_epoch__,
initialized_at_cluster_version: initialized_at_cluster_version__,
created_at_cluster_version: created_at_cluster_version__,
secret_refs: secret_refs__.unwrap_or_default(),
version: version__.unwrap_or_default(),
rate_limit: rate_limit__,
optional_associated_table_id: optional_associated_table_id__,
})
}
}
deserializer.deserialize_struct("catalog.Source", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for StreamJobStatus {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "STREAM_JOB_STATUS_UNSPECIFIED",
Self::Creating => "STREAM_JOB_STATUS_CREATING",
Self::Created => "STREAM_JOB_STATUS_CREATED",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for StreamJobStatus {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"STREAM_JOB_STATUS_UNSPECIFIED",
"STREAM_JOB_STATUS_CREATING",
"STREAM_JOB_STATUS_CREATED",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = StreamJobStatus;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"STREAM_JOB_STATUS_UNSPECIFIED" => Ok(StreamJobStatus::Unspecified),
"STREAM_JOB_STATUS_CREATING" => Ok(StreamJobStatus::Creating),
"STREAM_JOB_STATUS_CREATED" => Ok(StreamJobStatus::Created),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for StreamSourceInfo {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.row_format != 0 {
len += 1;
}
if !self.row_schema_location.is_empty() {
len += 1;
}
if self.use_schema_registry {
len += 1;
}
if !self.proto_message_name.is_empty() {
len += 1;
}
if self.csv_delimiter != 0 {
len += 1;
}
if self.csv_has_header {
len += 1;
}
if self.format != 0 {
len += 1;
}
if self.row_encode != 0 {
len += 1;
}
if self.name_strategy != 0 {
len += 1;
}
if self.key_message_name.is_some() {
len += 1;
}
if self.external_table.is_some() {
len += 1;
}
if self.cdc_source_job {
len += 1;
}
if self.is_distributed {
len += 1;
}
if !self.format_encode_options.is_empty() {
len += 1;
}
if !self.format_encode_secret_refs.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.StreamSourceInfo", len)?;
if self.row_format != 0 {
let v = super::plan_common::RowFormatType::try_from(self.row_format)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.row_format)))?;
struct_ser.serialize_field("rowFormat", &v)?;
}
if !self.row_schema_location.is_empty() {
struct_ser.serialize_field("rowSchemaLocation", &self.row_schema_location)?;
}
if self.use_schema_registry {
struct_ser.serialize_field("useSchemaRegistry", &self.use_schema_registry)?;
}
if !self.proto_message_name.is_empty() {
struct_ser.serialize_field("protoMessageName", &self.proto_message_name)?;
}
if self.csv_delimiter != 0 {
struct_ser.serialize_field("csvDelimiter", &self.csv_delimiter)?;
}
if self.csv_has_header {
struct_ser.serialize_field("csvHasHeader", &self.csv_has_header)?;
}
if self.format != 0 {
let v = super::plan_common::FormatType::try_from(self.format)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.format)))?;
struct_ser.serialize_field("format", &v)?;
}
if self.row_encode != 0 {
let v = super::plan_common::EncodeType::try_from(self.row_encode)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.row_encode)))?;
struct_ser.serialize_field("rowEncode", &v)?;
}
if self.name_strategy != 0 {
let v = SchemaRegistryNameStrategy::try_from(self.name_strategy)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.name_strategy)))?;
struct_ser.serialize_field("nameStrategy", &v)?;
}
if let Some(v) = self.key_message_name.as_ref() {
struct_ser.serialize_field("keyMessageName", v)?;
}
if let Some(v) = self.external_table.as_ref() {
struct_ser.serialize_field("externalTable", v)?;
}
if self.cdc_source_job {
struct_ser.serialize_field("cdcSourceJob", &self.cdc_source_job)?;
}
if self.is_distributed {
struct_ser.serialize_field("isDistributed", &self.is_distributed)?;
}
if !self.format_encode_options.is_empty() {
struct_ser.serialize_field("formatEncodeOptions", &self.format_encode_options)?;
}
if !self.format_encode_secret_refs.is_empty() {
struct_ser.serialize_field("formatEncodeSecretRefs", &self.format_encode_secret_refs)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for StreamSourceInfo {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"row_format",
"rowFormat",
"row_schema_location",
"rowSchemaLocation",
"use_schema_registry",
"useSchemaRegistry",
"proto_message_name",
"protoMessageName",
"csv_delimiter",
"csvDelimiter",
"csv_has_header",
"csvHasHeader",
"format",
"row_encode",
"rowEncode",
"name_strategy",
"nameStrategy",
"key_message_name",
"keyMessageName",
"external_table",
"externalTable",
"cdc_source_job",
"cdcSourceJob",
"is_distributed",
"isDistributed",
"format_encode_options",
"formatEncodeOptions",
"format_encode_secret_refs",
"formatEncodeSecretRefs",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
RowFormat,
RowSchemaLocation,
UseSchemaRegistry,
ProtoMessageName,
CsvDelimiter,
CsvHasHeader,
Format,
RowEncode,
NameStrategy,
KeyMessageName,
ExternalTable,
CdcSourceJob,
IsDistributed,
FormatEncodeOptions,
FormatEncodeSecretRefs,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"rowFormat" | "row_format" => Ok(GeneratedField::RowFormat),
"rowSchemaLocation" | "row_schema_location" => Ok(GeneratedField::RowSchemaLocation),
"useSchemaRegistry" | "use_schema_registry" => Ok(GeneratedField::UseSchemaRegistry),
"protoMessageName" | "proto_message_name" => Ok(GeneratedField::ProtoMessageName),
"csvDelimiter" | "csv_delimiter" => Ok(GeneratedField::CsvDelimiter),
"csvHasHeader" | "csv_has_header" => Ok(GeneratedField::CsvHasHeader),
"format" => Ok(GeneratedField::Format),
"rowEncode" | "row_encode" => Ok(GeneratedField::RowEncode),
"nameStrategy" | "name_strategy" => Ok(GeneratedField::NameStrategy),
"keyMessageName" | "key_message_name" => Ok(GeneratedField::KeyMessageName),
"externalTable" | "external_table" => Ok(GeneratedField::ExternalTable),
"cdcSourceJob" | "cdc_source_job" => Ok(GeneratedField::CdcSourceJob),
"isDistributed" | "is_distributed" => Ok(GeneratedField::IsDistributed),
"formatEncodeOptions" | "format_encode_options" => Ok(GeneratedField::FormatEncodeOptions),
"formatEncodeSecretRefs" | "format_encode_secret_refs" => Ok(GeneratedField::FormatEncodeSecretRefs),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = StreamSourceInfo;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.StreamSourceInfo")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<StreamSourceInfo, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut row_format__ = None;
let mut row_schema_location__ = None;
let mut use_schema_registry__ = None;
let mut proto_message_name__ = None;
let mut csv_delimiter__ = None;
let mut csv_has_header__ = None;
let mut format__ = None;
let mut row_encode__ = None;
let mut name_strategy__ = None;
let mut key_message_name__ = None;
let mut external_table__ = None;
let mut cdc_source_job__ = None;
let mut is_distributed__ = None;
let mut format_encode_options__ = None;
let mut format_encode_secret_refs__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::RowFormat => {
if row_format__.is_some() {
return Err(serde::de::Error::duplicate_field("rowFormat"));
}
row_format__ = Some(map_.next_value::<super::plan_common::RowFormatType>()? as i32);
}
GeneratedField::RowSchemaLocation => {
if row_schema_location__.is_some() {
return Err(serde::de::Error::duplicate_field("rowSchemaLocation"));
}
row_schema_location__ = Some(map_.next_value()?);
}
GeneratedField::UseSchemaRegistry => {
if use_schema_registry__.is_some() {
return Err(serde::de::Error::duplicate_field("useSchemaRegistry"));
}
use_schema_registry__ = Some(map_.next_value()?);
}
GeneratedField::ProtoMessageName => {
if proto_message_name__.is_some() {
return Err(serde::de::Error::duplicate_field("protoMessageName"));
}
proto_message_name__ = Some(map_.next_value()?);
}
GeneratedField::CsvDelimiter => {
if csv_delimiter__.is_some() {
return Err(serde::de::Error::duplicate_field("csvDelimiter"));
}
csv_delimiter__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::CsvHasHeader => {
if csv_has_header__.is_some() {
return Err(serde::de::Error::duplicate_field("csvHasHeader"));
}
csv_has_header__ = Some(map_.next_value()?);
}
GeneratedField::Format => {
if format__.is_some() {
return Err(serde::de::Error::duplicate_field("format"));
}
format__ = Some(map_.next_value::<super::plan_common::FormatType>()? as i32);
}
GeneratedField::RowEncode => {
if row_encode__.is_some() {
return Err(serde::de::Error::duplicate_field("rowEncode"));
}
row_encode__ = Some(map_.next_value::<super::plan_common::EncodeType>()? as i32);
}
GeneratedField::NameStrategy => {
if name_strategy__.is_some() {
return Err(serde::de::Error::duplicate_field("nameStrategy"));
}
name_strategy__ = Some(map_.next_value::<SchemaRegistryNameStrategy>()? as i32);
}
GeneratedField::KeyMessageName => {
if key_message_name__.is_some() {
return Err(serde::de::Error::duplicate_field("keyMessageName"));
}
key_message_name__ = map_.next_value()?;
}
GeneratedField::ExternalTable => {
if external_table__.is_some() {
return Err(serde::de::Error::duplicate_field("externalTable"));
}
external_table__ = map_.next_value()?;
}
GeneratedField::CdcSourceJob => {
if cdc_source_job__.is_some() {
return Err(serde::de::Error::duplicate_field("cdcSourceJob"));
}
cdc_source_job__ = Some(map_.next_value()?);
}
GeneratedField::IsDistributed => {
if is_distributed__.is_some() {
return Err(serde::de::Error::duplicate_field("isDistributed"));
}
is_distributed__ = Some(map_.next_value()?);
}
GeneratedField::FormatEncodeOptions => {
if format_encode_options__.is_some() {
return Err(serde::de::Error::duplicate_field("formatEncodeOptions"));
}
format_encode_options__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::FormatEncodeSecretRefs => {
if format_encode_secret_refs__.is_some() {
return Err(serde::de::Error::duplicate_field("formatEncodeSecretRefs"));
}
format_encode_secret_refs__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
}
}
Ok(StreamSourceInfo {
row_format: row_format__.unwrap_or_default(),
row_schema_location: row_schema_location__.unwrap_or_default(),
use_schema_registry: use_schema_registry__.unwrap_or_default(),
proto_message_name: proto_message_name__.unwrap_or_default(),
csv_delimiter: csv_delimiter__.unwrap_or_default(),
csv_has_header: csv_has_header__.unwrap_or_default(),
format: format__.unwrap_or_default(),
row_encode: row_encode__.unwrap_or_default(),
name_strategy: name_strategy__.unwrap_or_default(),
key_message_name: key_message_name__,
external_table: external_table__,
cdc_source_job: cdc_source_job__.unwrap_or_default(),
is_distributed: is_distributed__.unwrap_or_default(),
format_encode_options: format_encode_options__.unwrap_or_default(),
format_encode_secret_refs: format_encode_secret_refs__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.StreamSourceInfo", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for Subscription {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if !self.definition.is_empty() {
len += 1;
}
if self.retention_seconds != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.dependent_table_id != 0 {
len += 1;
}
if self.initialized_at_epoch.is_some() {
len += 1;
}
if self.created_at_epoch.is_some() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if self.initialized_at_cluster_version.is_some() {
len += 1;
}
if self.created_at_cluster_version.is_some() {
len += 1;
}
if self.subscription_state != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Subscription", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if !self.definition.is_empty() {
struct_ser.serialize_field("definition", &self.definition)?;
}
if self.retention_seconds != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("retentionSeconds", ToString::to_string(&self.retention_seconds).as_str())?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.dependent_table_id != 0 {
struct_ser.serialize_field("dependentTableId", &self.dependent_table_id)?;
}
if let Some(v) = self.initialized_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
}
if let Some(v) = self.created_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if let Some(v) = self.initialized_at_cluster_version.as_ref() {
struct_ser.serialize_field("initializedAtClusterVersion", v)?;
}
if let Some(v) = self.created_at_cluster_version.as_ref() {
struct_ser.serialize_field("createdAtClusterVersion", v)?;
}
if self.subscription_state != 0 {
let v = subscription::SubscriptionState::try_from(self.subscription_state)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.subscription_state)))?;
struct_ser.serialize_field("subscriptionState", &v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Subscription {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"name",
"definition",
"retention_seconds",
"retentionSeconds",
"database_id",
"databaseId",
"schema_id",
"schemaId",
"dependent_table_id",
"dependentTableId",
"initialized_at_epoch",
"initializedAtEpoch",
"created_at_epoch",
"createdAtEpoch",
"owner",
"initialized_at_cluster_version",
"initializedAtClusterVersion",
"created_at_cluster_version",
"createdAtClusterVersion",
"subscription_state",
"subscriptionState",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
Name,
Definition,
RetentionSeconds,
DatabaseId,
SchemaId,
DependentTableId,
InitializedAtEpoch,
CreatedAtEpoch,
Owner,
InitializedAtClusterVersion,
CreatedAtClusterVersion,
SubscriptionState,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"name" => Ok(GeneratedField::Name),
"definition" => Ok(GeneratedField::Definition),
"retentionSeconds" | "retention_seconds" => Ok(GeneratedField::RetentionSeconds),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"dependentTableId" | "dependent_table_id" => Ok(GeneratedField::DependentTableId),
"initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
"createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
"owner" => Ok(GeneratedField::Owner),
"initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
"createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
"subscriptionState" | "subscription_state" => Ok(GeneratedField::SubscriptionState),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Subscription;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Subscription")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Subscription, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut name__ = None;
let mut definition__ = None;
let mut retention_seconds__ = None;
let mut database_id__ = None;
let mut schema_id__ = None;
let mut dependent_table_id__ = None;
let mut initialized_at_epoch__ = None;
let mut created_at_epoch__ = None;
let mut owner__ = None;
let mut initialized_at_cluster_version__ = None;
let mut created_at_cluster_version__ = None;
let mut subscription_state__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Definition => {
if definition__.is_some() {
return Err(serde::de::Error::duplicate_field("definition"));
}
definition__ = Some(map_.next_value()?);
}
GeneratedField::RetentionSeconds => {
if retention_seconds__.is_some() {
return Err(serde::de::Error::duplicate_field("retentionSeconds"));
}
retention_seconds__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DependentTableId => {
if dependent_table_id__.is_some() {
return Err(serde::de::Error::duplicate_field("dependentTableId"));
}
dependent_table_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::InitializedAtEpoch => {
if initialized_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
}
initialized_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::CreatedAtEpoch => {
if created_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
}
created_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::InitializedAtClusterVersion => {
if initialized_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
}
initialized_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::CreatedAtClusterVersion => {
if created_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
}
created_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::SubscriptionState => {
if subscription_state__.is_some() {
return Err(serde::de::Error::duplicate_field("subscriptionState"));
}
subscription_state__ = Some(map_.next_value::<subscription::SubscriptionState>()? as i32);
}
}
}
Ok(Subscription {
id: id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
definition: definition__.unwrap_or_default(),
retention_seconds: retention_seconds__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
dependent_table_id: dependent_table_id__.unwrap_or_default(),
initialized_at_epoch: initialized_at_epoch__,
created_at_epoch: created_at_epoch__,
owner: owner__.unwrap_or_default(),
initialized_at_cluster_version: initialized_at_cluster_version__,
created_at_cluster_version: created_at_cluster_version__,
subscription_state: subscription_state__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.Subscription", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for subscription::SubscriptionState {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "UNSPECIFIED",
Self::Init => "INIT",
Self::Created => "CREATED",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for subscription::SubscriptionState {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"UNSPECIFIED",
"INIT",
"CREATED",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = subscription::SubscriptionState;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"UNSPECIFIED" => Ok(subscription::SubscriptionState::Unspecified),
"INIT" => Ok(subscription::SubscriptionState::Init),
"CREATED" => Ok(subscription::SubscriptionState::Created),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for Table {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if !self.columns.is_empty() {
len += 1;
}
if !self.pk.is_empty() {
len += 1;
}
if !self.dependent_relations.is_empty() {
len += 1;
}
if self.table_type != 0 {
len += 1;
}
if !self.distribution_key.is_empty() {
len += 1;
}
if !self.stream_key.is_empty() {
len += 1;
}
if self.append_only {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if self.fragment_id != 0 {
len += 1;
}
if self.vnode_col_index.is_some() {
len += 1;
}
if self.row_id_index.is_some() {
len += 1;
}
if !self.value_indices.is_empty() {
len += 1;
}
if !self.definition.is_empty() {
len += 1;
}
if self.handle_pk_conflict_behavior != 0 {
len += 1;
}
if self.read_prefix_len_hint != 0 {
len += 1;
}
if !self.watermark_indices.is_empty() {
len += 1;
}
if !self.dist_key_in_pk.is_empty() {
len += 1;
}
if self.dml_fragment_id.is_some() {
len += 1;
}
if self.cardinality.is_some() {
len += 1;
}
if self.initialized_at_epoch.is_some() {
len += 1;
}
if self.created_at_epoch.is_some() {
len += 1;
}
if self.cleaned_by_watermark {
len += 1;
}
if self.stream_job_status != 0 {
len += 1;
}
if self.create_type != 0 {
len += 1;
}
if self.description.is_some() {
len += 1;
}
if !self.incoming_sinks.is_empty() {
len += 1;
}
if self.initialized_at_cluster_version.is_some() {
len += 1;
}
if self.created_at_cluster_version.is_some() {
len += 1;
}
if self.retention_seconds.is_some() {
len += 1;
}
if self.version_column_index.is_some() {
len += 1;
}
if self.cdc_table_id.is_some() {
len += 1;
}
if self.maybe_vnode_count.is_some() {
len += 1;
}
if self.version.is_some() {
len += 1;
}
if self.optional_associated_source_id.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Table", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if !self.columns.is_empty() {
struct_ser.serialize_field("columns", &self.columns)?;
}
if !self.pk.is_empty() {
struct_ser.serialize_field("pk", &self.pk)?;
}
if !self.dependent_relations.is_empty() {
struct_ser.serialize_field("dependentRelations", &self.dependent_relations)?;
}
if self.table_type != 0 {
let v = table::TableType::try_from(self.table_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.table_type)))?;
struct_ser.serialize_field("tableType", &v)?;
}
if !self.distribution_key.is_empty() {
struct_ser.serialize_field("distributionKey", &self.distribution_key)?;
}
if !self.stream_key.is_empty() {
struct_ser.serialize_field("streamKey", &self.stream_key)?;
}
if self.append_only {
struct_ser.serialize_field("appendOnly", &self.append_only)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if self.fragment_id != 0 {
struct_ser.serialize_field("fragmentId", &self.fragment_id)?;
}
if let Some(v) = self.vnode_col_index.as_ref() {
struct_ser.serialize_field("vnodeColIndex", v)?;
}
if let Some(v) = self.row_id_index.as_ref() {
struct_ser.serialize_field("rowIdIndex", v)?;
}
if !self.value_indices.is_empty() {
struct_ser.serialize_field("valueIndices", &self.value_indices)?;
}
if !self.definition.is_empty() {
struct_ser.serialize_field("definition", &self.definition)?;
}
if self.handle_pk_conflict_behavior != 0 {
let v = HandleConflictBehavior::try_from(self.handle_pk_conflict_behavior)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.handle_pk_conflict_behavior)))?;
struct_ser.serialize_field("handlePkConflictBehavior", &v)?;
}
if self.read_prefix_len_hint != 0 {
struct_ser.serialize_field("readPrefixLenHint", &self.read_prefix_len_hint)?;
}
if !self.watermark_indices.is_empty() {
struct_ser.serialize_field("watermarkIndices", &self.watermark_indices)?;
}
if !self.dist_key_in_pk.is_empty() {
struct_ser.serialize_field("distKeyInPk", &self.dist_key_in_pk)?;
}
if let Some(v) = self.dml_fragment_id.as_ref() {
struct_ser.serialize_field("dmlFragmentId", v)?;
}
if let Some(v) = self.cardinality.as_ref() {
struct_ser.serialize_field("cardinality", v)?;
}
if let Some(v) = self.initialized_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
}
if let Some(v) = self.created_at_epoch.as_ref() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
}
if self.cleaned_by_watermark {
struct_ser.serialize_field("cleanedByWatermark", &self.cleaned_by_watermark)?;
}
if self.stream_job_status != 0 {
let v = StreamJobStatus::try_from(self.stream_job_status)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.stream_job_status)))?;
struct_ser.serialize_field("streamJobStatus", &v)?;
}
if self.create_type != 0 {
let v = CreateType::try_from(self.create_type)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.create_type)))?;
struct_ser.serialize_field("createType", &v)?;
}
if let Some(v) = self.description.as_ref() {
struct_ser.serialize_field("description", v)?;
}
if !self.incoming_sinks.is_empty() {
struct_ser.serialize_field("incomingSinks", &self.incoming_sinks)?;
}
if let Some(v) = self.initialized_at_cluster_version.as_ref() {
struct_ser.serialize_field("initializedAtClusterVersion", v)?;
}
if let Some(v) = self.created_at_cluster_version.as_ref() {
struct_ser.serialize_field("createdAtClusterVersion", v)?;
}
if let Some(v) = self.retention_seconds.as_ref() {
struct_ser.serialize_field("retentionSeconds", v)?;
}
if let Some(v) = self.version_column_index.as_ref() {
struct_ser.serialize_field("versionColumnIndex", v)?;
}
if let Some(v) = self.cdc_table_id.as_ref() {
struct_ser.serialize_field("cdcTableId", v)?;
}
if let Some(v) = self.maybe_vnode_count.as_ref() {
struct_ser.serialize_field("maybeVnodeCount", v)?;
}
if let Some(v) = self.version.as_ref() {
struct_ser.serialize_field("version", v)?;
}
if let Some(v) = self.optional_associated_source_id.as_ref() {
match v {
table::OptionalAssociatedSourceId::AssociatedSourceId(v) => {
struct_ser.serialize_field("associatedSourceId", v)?;
}
}
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for Table {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"name",
"columns",
"pk",
"dependent_relations",
"dependentRelations",
"table_type",
"tableType",
"distribution_key",
"distributionKey",
"stream_key",
"streamKey",
"append_only",
"appendOnly",
"owner",
"fragment_id",
"fragmentId",
"vnode_col_index",
"vnodeColIndex",
"row_id_index",
"rowIdIndex",
"value_indices",
"valueIndices",
"definition",
"handle_pk_conflict_behavior",
"handlePkConflictBehavior",
"read_prefix_len_hint",
"readPrefixLenHint",
"watermark_indices",
"watermarkIndices",
"dist_key_in_pk",
"distKeyInPk",
"dml_fragment_id",
"dmlFragmentId",
"cardinality",
"initialized_at_epoch",
"initializedAtEpoch",
"created_at_epoch",
"createdAtEpoch",
"cleaned_by_watermark",
"cleanedByWatermark",
"stream_job_status",
"streamJobStatus",
"create_type",
"createType",
"description",
"incoming_sinks",
"incomingSinks",
"initialized_at_cluster_version",
"initializedAtClusterVersion",
"created_at_cluster_version",
"createdAtClusterVersion",
"retention_seconds",
"retentionSeconds",
"version_column_index",
"versionColumnIndex",
"cdc_table_id",
"cdcTableId",
"maybe_vnode_count",
"maybeVnodeCount",
"version",
"associated_source_id",
"associatedSourceId",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
SchemaId,
DatabaseId,
Name,
Columns,
Pk,
DependentRelations,
TableType,
DistributionKey,
StreamKey,
AppendOnly,
Owner,
FragmentId,
VnodeColIndex,
RowIdIndex,
ValueIndices,
Definition,
HandlePkConflictBehavior,
ReadPrefixLenHint,
WatermarkIndices,
DistKeyInPk,
DmlFragmentId,
Cardinality,
InitializedAtEpoch,
CreatedAtEpoch,
CleanedByWatermark,
StreamJobStatus,
CreateType,
Description,
IncomingSinks,
InitializedAtClusterVersion,
CreatedAtClusterVersion,
RetentionSeconds,
VersionColumnIndex,
CdcTableId,
MaybeVnodeCount,
Version,
AssociatedSourceId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"columns" => Ok(GeneratedField::Columns),
"pk" => Ok(GeneratedField::Pk),
"dependentRelations" | "dependent_relations" => Ok(GeneratedField::DependentRelations),
"tableType" | "table_type" => Ok(GeneratedField::TableType),
"distributionKey" | "distribution_key" => Ok(GeneratedField::DistributionKey),
"streamKey" | "stream_key" => Ok(GeneratedField::StreamKey),
"appendOnly" | "append_only" => Ok(GeneratedField::AppendOnly),
"owner" => Ok(GeneratedField::Owner),
"fragmentId" | "fragment_id" => Ok(GeneratedField::FragmentId),
"vnodeColIndex" | "vnode_col_index" => Ok(GeneratedField::VnodeColIndex),
"rowIdIndex" | "row_id_index" => Ok(GeneratedField::RowIdIndex),
"valueIndices" | "value_indices" => Ok(GeneratedField::ValueIndices),
"definition" => Ok(GeneratedField::Definition),
"handlePkConflictBehavior" | "handle_pk_conflict_behavior" => Ok(GeneratedField::HandlePkConflictBehavior),
"readPrefixLenHint" | "read_prefix_len_hint" => Ok(GeneratedField::ReadPrefixLenHint),
"watermarkIndices" | "watermark_indices" => Ok(GeneratedField::WatermarkIndices),
"distKeyInPk" | "dist_key_in_pk" => Ok(GeneratedField::DistKeyInPk),
"dmlFragmentId" | "dml_fragment_id" => Ok(GeneratedField::DmlFragmentId),
"cardinality" => Ok(GeneratedField::Cardinality),
"initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
"createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
"cleanedByWatermark" | "cleaned_by_watermark" => Ok(GeneratedField::CleanedByWatermark),
"streamJobStatus" | "stream_job_status" => Ok(GeneratedField::StreamJobStatus),
"createType" | "create_type" => Ok(GeneratedField::CreateType),
"description" => Ok(GeneratedField::Description),
"incomingSinks" | "incoming_sinks" => Ok(GeneratedField::IncomingSinks),
"initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
"createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
"retentionSeconds" | "retention_seconds" => Ok(GeneratedField::RetentionSeconds),
"versionColumnIndex" | "version_column_index" => Ok(GeneratedField::VersionColumnIndex),
"cdcTableId" | "cdc_table_id" => Ok(GeneratedField::CdcTableId),
"maybeVnodeCount" | "maybe_vnode_count" => Ok(GeneratedField::MaybeVnodeCount),
"version" => Ok(GeneratedField::Version),
"associatedSourceId" | "associated_source_id" => Ok(GeneratedField::AssociatedSourceId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = Table;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Table")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Table, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut columns__ = None;
let mut pk__ = None;
let mut dependent_relations__ = None;
let mut table_type__ = None;
let mut distribution_key__ = None;
let mut stream_key__ = None;
let mut append_only__ = None;
let mut owner__ = None;
let mut fragment_id__ = None;
let mut vnode_col_index__ = None;
let mut row_id_index__ = None;
let mut value_indices__ = None;
let mut definition__ = None;
let mut handle_pk_conflict_behavior__ = None;
let mut read_prefix_len_hint__ = None;
let mut watermark_indices__ = None;
let mut dist_key_in_pk__ = None;
let mut dml_fragment_id__ = None;
let mut cardinality__ = None;
let mut initialized_at_epoch__ = None;
let mut created_at_epoch__ = None;
let mut cleaned_by_watermark__ = None;
let mut stream_job_status__ = None;
let mut create_type__ = None;
let mut description__ = None;
let mut incoming_sinks__ = None;
let mut initialized_at_cluster_version__ = None;
let mut created_at_cluster_version__ = None;
let mut retention_seconds__ = None;
let mut version_column_index__ = None;
let mut cdc_table_id__ = None;
let mut maybe_vnode_count__ = None;
let mut version__ = None;
let mut optional_associated_source_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Columns => {
if columns__.is_some() {
return Err(serde::de::Error::duplicate_field("columns"));
}
columns__ = Some(map_.next_value()?);
}
GeneratedField::Pk => {
if pk__.is_some() {
return Err(serde::de::Error::duplicate_field("pk"));
}
pk__ = Some(map_.next_value()?);
}
GeneratedField::DependentRelations => {
if dependent_relations__.is_some() {
return Err(serde::de::Error::duplicate_field("dependentRelations"));
}
dependent_relations__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::TableType => {
if table_type__.is_some() {
return Err(serde::de::Error::duplicate_field("tableType"));
}
table_type__ = Some(map_.next_value::<table::TableType>()? as i32);
}
GeneratedField::DistributionKey => {
if distribution_key__.is_some() {
return Err(serde::de::Error::duplicate_field("distributionKey"));
}
distribution_key__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::StreamKey => {
if stream_key__.is_some() {
return Err(serde::de::Error::duplicate_field("streamKey"));
}
stream_key__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::AppendOnly => {
if append_only__.is_some() {
return Err(serde::de::Error::duplicate_field("appendOnly"));
}
append_only__ = Some(map_.next_value()?);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::FragmentId => {
if fragment_id__.is_some() {
return Err(serde::de::Error::duplicate_field("fragmentId"));
}
fragment_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::VnodeColIndex => {
if vnode_col_index__.is_some() {
return Err(serde::de::Error::duplicate_field("vnodeColIndex"));
}
vnode_col_index__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::RowIdIndex => {
if row_id_index__.is_some() {
return Err(serde::de::Error::duplicate_field("rowIdIndex"));
}
row_id_index__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::ValueIndices => {
if value_indices__.is_some() {
return Err(serde::de::Error::duplicate_field("valueIndices"));
}
value_indices__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::Definition => {
if definition__.is_some() {
return Err(serde::de::Error::duplicate_field("definition"));
}
definition__ = Some(map_.next_value()?);
}
GeneratedField::HandlePkConflictBehavior => {
if handle_pk_conflict_behavior__.is_some() {
return Err(serde::de::Error::duplicate_field("handlePkConflictBehavior"));
}
handle_pk_conflict_behavior__ = Some(map_.next_value::<HandleConflictBehavior>()? as i32);
}
GeneratedField::ReadPrefixLenHint => {
if read_prefix_len_hint__.is_some() {
return Err(serde::de::Error::duplicate_field("readPrefixLenHint"));
}
read_prefix_len_hint__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::WatermarkIndices => {
if watermark_indices__.is_some() {
return Err(serde::de::Error::duplicate_field("watermarkIndices"));
}
watermark_indices__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::DistKeyInPk => {
if dist_key_in_pk__.is_some() {
return Err(serde::de::Error::duplicate_field("distKeyInPk"));
}
dist_key_in_pk__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::DmlFragmentId => {
if dml_fragment_id__.is_some() {
return Err(serde::de::Error::duplicate_field("dmlFragmentId"));
}
dml_fragment_id__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::Cardinality => {
if cardinality__.is_some() {
return Err(serde::de::Error::duplicate_field("cardinality"));
}
cardinality__ = map_.next_value()?;
}
GeneratedField::InitializedAtEpoch => {
if initialized_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
}
initialized_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::CreatedAtEpoch => {
if created_at_epoch__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
}
created_at_epoch__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::CleanedByWatermark => {
if cleaned_by_watermark__.is_some() {
return Err(serde::de::Error::duplicate_field("cleanedByWatermark"));
}
cleaned_by_watermark__ = Some(map_.next_value()?);
}
GeneratedField::StreamJobStatus => {
if stream_job_status__.is_some() {
return Err(serde::de::Error::duplicate_field("streamJobStatus"));
}
stream_job_status__ = Some(map_.next_value::<StreamJobStatus>()? as i32);
}
GeneratedField::CreateType => {
if create_type__.is_some() {
return Err(serde::de::Error::duplicate_field("createType"));
}
create_type__ = Some(map_.next_value::<CreateType>()? as i32);
}
GeneratedField::Description => {
if description__.is_some() {
return Err(serde::de::Error::duplicate_field("description"));
}
description__ = map_.next_value()?;
}
GeneratedField::IncomingSinks => {
if incoming_sinks__.is_some() {
return Err(serde::de::Error::duplicate_field("incomingSinks"));
}
incoming_sinks__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::InitializedAtClusterVersion => {
if initialized_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
}
initialized_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::CreatedAtClusterVersion => {
if created_at_cluster_version__.is_some() {
return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
}
created_at_cluster_version__ = map_.next_value()?;
}
GeneratedField::RetentionSeconds => {
if retention_seconds__.is_some() {
return Err(serde::de::Error::duplicate_field("retentionSeconds"));
}
retention_seconds__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::VersionColumnIndex => {
if version_column_index__.is_some() {
return Err(serde::de::Error::duplicate_field("versionColumnIndex"));
}
version_column_index__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::CdcTableId => {
if cdc_table_id__.is_some() {
return Err(serde::de::Error::duplicate_field("cdcTableId"));
}
cdc_table_id__ = map_.next_value()?;
}
GeneratedField::MaybeVnodeCount => {
if maybe_vnode_count__.is_some() {
return Err(serde::de::Error::duplicate_field("maybeVnodeCount"));
}
maybe_vnode_count__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::Version => {
if version__.is_some() {
return Err(serde::de::Error::duplicate_field("version"));
}
version__ = map_.next_value()?;
}
GeneratedField::AssociatedSourceId => {
if optional_associated_source_id__.is_some() {
return Err(serde::de::Error::duplicate_field("associatedSourceId"));
}
optional_associated_source_id__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| table::OptionalAssociatedSourceId::AssociatedSourceId(x.0));
}
}
}
Ok(Table {
id: id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
columns: columns__.unwrap_or_default(),
pk: pk__.unwrap_or_default(),
dependent_relations: dependent_relations__.unwrap_or_default(),
table_type: table_type__.unwrap_or_default(),
distribution_key: distribution_key__.unwrap_or_default(),
stream_key: stream_key__.unwrap_or_default(),
append_only: append_only__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
fragment_id: fragment_id__.unwrap_or_default(),
vnode_col_index: vnode_col_index__,
row_id_index: row_id_index__,
value_indices: value_indices__.unwrap_or_default(),
definition: definition__.unwrap_or_default(),
handle_pk_conflict_behavior: handle_pk_conflict_behavior__.unwrap_or_default(),
read_prefix_len_hint: read_prefix_len_hint__.unwrap_or_default(),
watermark_indices: watermark_indices__.unwrap_or_default(),
dist_key_in_pk: dist_key_in_pk__.unwrap_or_default(),
dml_fragment_id: dml_fragment_id__,
cardinality: cardinality__,
initialized_at_epoch: initialized_at_epoch__,
created_at_epoch: created_at_epoch__,
cleaned_by_watermark: cleaned_by_watermark__.unwrap_or_default(),
stream_job_status: stream_job_status__.unwrap_or_default(),
create_type: create_type__.unwrap_or_default(),
description: description__,
incoming_sinks: incoming_sinks__.unwrap_or_default(),
initialized_at_cluster_version: initialized_at_cluster_version__,
created_at_cluster_version: created_at_cluster_version__,
retention_seconds: retention_seconds__,
version_column_index: version_column_index__,
cdc_table_id: cdc_table_id__,
maybe_vnode_count: maybe_vnode_count__,
version: version__,
optional_associated_source_id: optional_associated_source_id__,
})
}
}
deserializer.deserialize_struct("catalog.Table", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for table::TableType {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "UNSPECIFIED",
Self::Table => "TABLE",
Self::MaterializedView => "MATERIALIZED_VIEW",
Self::Index => "INDEX",
Self::Internal => "INTERNAL",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for table::TableType {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"UNSPECIFIED",
"TABLE",
"MATERIALIZED_VIEW",
"INDEX",
"INTERNAL",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = table::TableType;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"UNSPECIFIED" => Ok(table::TableType::Unspecified),
"TABLE" => Ok(table::TableType::Table),
"MATERIALIZED_VIEW" => Ok(table::TableType::MaterializedView),
"INDEX" => Ok(table::TableType::Index),
"INTERNAL" => Ok(table::TableType::Internal),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for table::TableVersion {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.version != 0 {
len += 1;
}
if self.next_column_id != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.Table.TableVersion", len)?;
if self.version != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
}
if self.next_column_id != 0 {
struct_ser.serialize_field("nextColumnId", &self.next_column_id)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for table::TableVersion {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"version",
"next_column_id",
"nextColumnId",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Version,
NextColumnId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"version" => Ok(GeneratedField::Version),
"nextColumnId" | "next_column_id" => Ok(GeneratedField::NextColumnId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = table::TableVersion;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.Table.TableVersion")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<table::TableVersion, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut version__ = None;
let mut next_column_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Version => {
if version__.is_some() {
return Err(serde::de::Error::duplicate_field("version"));
}
version__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::NextColumnId => {
if next_column_id__.is_some() {
return Err(serde::de::Error::duplicate_field("nextColumnId"));
}
next_column_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(table::TableVersion {
version: version__.unwrap_or_default(),
next_column_id: next_column_id__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.Table.TableVersion", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for View {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.schema_id != 0 {
len += 1;
}
if self.database_id != 0 {
len += 1;
}
if !self.name.is_empty() {
len += 1;
}
if self.owner != 0 {
len += 1;
}
if !self.properties.is_empty() {
len += 1;
}
if !self.sql.is_empty() {
len += 1;
}
if !self.dependent_relations.is_empty() {
len += 1;
}
if !self.columns.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.View", len)?;
if self.id != 0 {
struct_ser.serialize_field("id", &self.id)?;
}
if self.schema_id != 0 {
struct_ser.serialize_field("schemaId", &self.schema_id)?;
}
if self.database_id != 0 {
struct_ser.serialize_field("databaseId", &self.database_id)?;
}
if !self.name.is_empty() {
struct_ser.serialize_field("name", &self.name)?;
}
if self.owner != 0 {
struct_ser.serialize_field("owner", &self.owner)?;
}
if !self.properties.is_empty() {
struct_ser.serialize_field("properties", &self.properties)?;
}
if !self.sql.is_empty() {
struct_ser.serialize_field("sql", &self.sql)?;
}
if !self.dependent_relations.is_empty() {
struct_ser.serialize_field("dependentRelations", &self.dependent_relations)?;
}
if !self.columns.is_empty() {
struct_ser.serialize_field("columns", &self.columns)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for View {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"schema_id",
"schemaId",
"database_id",
"databaseId",
"name",
"owner",
"properties",
"sql",
"dependent_relations",
"dependentRelations",
"columns",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
SchemaId,
DatabaseId,
Name,
Owner,
Properties,
Sql,
DependentRelations,
Columns,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
"databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
"name" => Ok(GeneratedField::Name),
"owner" => Ok(GeneratedField::Owner),
"properties" => Ok(GeneratedField::Properties),
"sql" => Ok(GeneratedField::Sql),
"dependentRelations" | "dependent_relations" => Ok(GeneratedField::DependentRelations),
"columns" => Ok(GeneratedField::Columns),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = View;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.View")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<View, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut schema_id__ = None;
let mut database_id__ = None;
let mut name__ = None;
let mut owner__ = None;
let mut properties__ = None;
let mut sql__ = None;
let mut dependent_relations__ = None;
let mut columns__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SchemaId => {
if schema_id__.is_some() {
return Err(serde::de::Error::duplicate_field("schemaId"));
}
schema_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::DatabaseId => {
if database_id__.is_some() {
return Err(serde::de::Error::duplicate_field("databaseId"));
}
database_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map_.next_value()?);
}
GeneratedField::Owner => {
if owner__.is_some() {
return Err(serde::de::Error::duplicate_field("owner"));
}
owner__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Properties => {
if properties__.is_some() {
return Err(serde::de::Error::duplicate_field("properties"));
}
properties__ = Some(
map_.next_value::<std::collections::BTreeMap<_, _>>()?
);
}
GeneratedField::Sql => {
if sql__.is_some() {
return Err(serde::de::Error::duplicate_field("sql"));
}
sql__ = Some(map_.next_value()?);
}
GeneratedField::DependentRelations => {
if dependent_relations__.is_some() {
return Err(serde::de::Error::duplicate_field("dependentRelations"));
}
dependent_relations__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
GeneratedField::Columns => {
if columns__.is_some() {
return Err(serde::de::Error::duplicate_field("columns"));
}
columns__ = Some(map_.next_value()?);
}
}
}
Ok(View {
id: id__.unwrap_or_default(),
schema_id: schema_id__.unwrap_or_default(),
database_id: database_id__.unwrap_or_default(),
name: name__.unwrap_or_default(),
owner: owner__.unwrap_or_default(),
properties: properties__.unwrap_or_default(),
sql: sql__.unwrap_or_default(),
dependent_relations: dependent_relations__.unwrap_or_default(),
columns: columns__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("catalog.View", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for WatermarkDesc {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.watermark_idx != 0 {
len += 1;
}
if self.expr.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("catalog.WatermarkDesc", len)?;
if self.watermark_idx != 0 {
struct_ser.serialize_field("watermarkIdx", &self.watermark_idx)?;
}
if let Some(v) = self.expr.as_ref() {
struct_ser.serialize_field("expr", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for WatermarkDesc {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"watermark_idx",
"watermarkIdx",
"expr",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
WatermarkIdx,
Expr,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"watermarkIdx" | "watermark_idx" => Ok(GeneratedField::WatermarkIdx),
"expr" => Ok(GeneratedField::Expr),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = WatermarkDesc;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct catalog.WatermarkDesc")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<WatermarkDesc, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut watermark_idx__ = None;
let mut expr__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::WatermarkIdx => {
if watermark_idx__.is_some() {
return Err(serde::de::Error::duplicate_field("watermarkIdx"));
}
watermark_idx__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Expr => {
if expr__.is_some() {
return Err(serde::de::Error::duplicate_field("expr"));
}
expr__ = map_.next_value()?;
}
}
}
Ok(WatermarkDesc {
watermark_idx: watermark_idx__.unwrap_or_default(),
expr: expr__,
})
}
}
deserializer.deserialize_struct("catalog.WatermarkDesc", FIELDS, GeneratedVisitor)
}
}