risingwave_pb/
data.serde.rs

1use crate::data::*;
2impl serde::Serialize for Array {
3    #[allow(deprecated)]
4    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5    where
6        S: serde::Serializer,
7    {
8        use serde::ser::SerializeStruct;
9        let mut len = 0;
10        if self.array_type != 0 {
11            len += 1;
12        }
13        if self.null_bitmap.is_some() {
14            len += 1;
15        }
16        if !self.values.is_empty() {
17            len += 1;
18        }
19        if self.struct_array_data.is_some() {
20            len += 1;
21        }
22        if self.list_array_data.is_some() {
23            len += 1;
24        }
25        let mut struct_ser = serializer.serialize_struct("data.Array", len)?;
26        if self.array_type != 0 {
27            let v = ArrayType::try_from(self.array_type)
28                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.array_type)))?;
29            struct_ser.serialize_field("arrayType", &v)?;
30        }
31        if let Some(v) = self.null_bitmap.as_ref() {
32            struct_ser.serialize_field("nullBitmap", v)?;
33        }
34        if !self.values.is_empty() {
35            struct_ser.serialize_field("values", &self.values)?;
36        }
37        if let Some(v) = self.struct_array_data.as_ref() {
38            struct_ser.serialize_field("structArrayData", v)?;
39        }
40        if let Some(v) = self.list_array_data.as_ref() {
41            struct_ser.serialize_field("listArrayData", v)?;
42        }
43        struct_ser.end()
44    }
45}
46impl<'de> serde::Deserialize<'de> for Array {
47    #[allow(deprecated)]
48    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
49    where
50        D: serde::Deserializer<'de>,
51    {
52        const FIELDS: &[&str] = &[
53            "array_type",
54            "arrayType",
55            "null_bitmap",
56            "nullBitmap",
57            "values",
58            "struct_array_data",
59            "structArrayData",
60            "list_array_data",
61            "listArrayData",
62        ];
63
64        #[allow(clippy::enum_variant_names)]
65        enum GeneratedField {
66            ArrayType,
67            NullBitmap,
68            Values,
69            StructArrayData,
70            ListArrayData,
71        }
72        impl<'de> serde::Deserialize<'de> for GeneratedField {
73            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
74            where
75                D: serde::Deserializer<'de>,
76            {
77                struct GeneratedVisitor;
78
79                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
80                    type Value = GeneratedField;
81
82                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
83                        write!(formatter, "expected one of: {:?}", &FIELDS)
84                    }
85
86                    #[allow(unused_variables)]
87                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
88                    where
89                        E: serde::de::Error,
90                    {
91                        match value {
92                            "arrayType" | "array_type" => Ok(GeneratedField::ArrayType),
93                            "nullBitmap" | "null_bitmap" => Ok(GeneratedField::NullBitmap),
94                            "values" => Ok(GeneratedField::Values),
95                            "structArrayData" | "struct_array_data" => Ok(GeneratedField::StructArrayData),
96                            "listArrayData" | "list_array_data" => Ok(GeneratedField::ListArrayData),
97                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
98                        }
99                    }
100                }
101                deserializer.deserialize_identifier(GeneratedVisitor)
102            }
103        }
104        struct GeneratedVisitor;
105        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
106            type Value = Array;
107
108            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
109                formatter.write_str("struct data.Array")
110            }
111
112            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Array, V::Error>
113                where
114                    V: serde::de::MapAccess<'de>,
115            {
116                let mut array_type__ = None;
117                let mut null_bitmap__ = None;
118                let mut values__ = None;
119                let mut struct_array_data__ = None;
120                let mut list_array_data__ = None;
121                while let Some(k) = map_.next_key()? {
122                    match k {
123                        GeneratedField::ArrayType => {
124                            if array_type__.is_some() {
125                                return Err(serde::de::Error::duplicate_field("arrayType"));
126                            }
127                            array_type__ = Some(map_.next_value::<ArrayType>()? as i32);
128                        }
129                        GeneratedField::NullBitmap => {
130                            if null_bitmap__.is_some() {
131                                return Err(serde::de::Error::duplicate_field("nullBitmap"));
132                            }
133                            null_bitmap__ = map_.next_value()?;
134                        }
135                        GeneratedField::Values => {
136                            if values__.is_some() {
137                                return Err(serde::de::Error::duplicate_field("values"));
138                            }
139                            values__ = Some(map_.next_value()?);
140                        }
141                        GeneratedField::StructArrayData => {
142                            if struct_array_data__.is_some() {
143                                return Err(serde::de::Error::duplicate_field("structArrayData"));
144                            }
145                            struct_array_data__ = map_.next_value()?;
146                        }
147                        GeneratedField::ListArrayData => {
148                            if list_array_data__.is_some() {
149                                return Err(serde::de::Error::duplicate_field("listArrayData"));
150                            }
151                            list_array_data__ = map_.next_value()?;
152                        }
153                    }
154                }
155                Ok(Array {
156                    array_type: array_type__.unwrap_or_default(),
157                    null_bitmap: null_bitmap__,
158                    values: values__.unwrap_or_default(),
159                    struct_array_data: struct_array_data__,
160                    list_array_data: list_array_data__,
161                })
162            }
163        }
164        deserializer.deserialize_struct("data.Array", FIELDS, GeneratedVisitor)
165    }
166}
167impl serde::Serialize for ArrayType {
168    #[allow(deprecated)]
169    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
170    where
171        S: serde::Serializer,
172    {
173        let variant = match self {
174            Self::Unspecified => "UNSPECIFIED",
175            Self::Int16 => "INT16",
176            Self::Int32 => "INT32",
177            Self::Int64 => "INT64",
178            Self::Float32 => "FLOAT32",
179            Self::Float64 => "FLOAT64",
180            Self::Utf8 => "UTF8",
181            Self::Bool => "BOOL",
182            Self::Decimal => "DECIMAL",
183            Self::Date => "DATE",
184            Self::Time => "TIME",
185            Self::Timestamp => "TIMESTAMP",
186            Self::Timestamptz => "TIMESTAMPTZ",
187            Self::Interval => "INTERVAL",
188            Self::Struct => "STRUCT",
189            Self::List => "LIST",
190            Self::Bytea => "BYTEA",
191            Self::Jsonb => "JSONB",
192            Self::Serial => "SERIAL",
193            Self::Int256 => "INT256",
194            Self::Map => "MAP",
195        };
196        serializer.serialize_str(variant)
197    }
198}
199impl<'de> serde::Deserialize<'de> for ArrayType {
200    #[allow(deprecated)]
201    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
202    where
203        D: serde::Deserializer<'de>,
204    {
205        const FIELDS: &[&str] = &[
206            "UNSPECIFIED",
207            "INT16",
208            "INT32",
209            "INT64",
210            "FLOAT32",
211            "FLOAT64",
212            "UTF8",
213            "BOOL",
214            "DECIMAL",
215            "DATE",
216            "TIME",
217            "TIMESTAMP",
218            "TIMESTAMPTZ",
219            "INTERVAL",
220            "STRUCT",
221            "LIST",
222            "BYTEA",
223            "JSONB",
224            "SERIAL",
225            "INT256",
226            "MAP",
227        ];
228
229        struct GeneratedVisitor;
230
231        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
232            type Value = ArrayType;
233
234            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
235                write!(formatter, "expected one of: {:?}", &FIELDS)
236            }
237
238            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
239            where
240                E: serde::de::Error,
241            {
242                i32::try_from(v)
243                    .ok()
244                    .and_then(|x| x.try_into().ok())
245                    .ok_or_else(|| {
246                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
247                    })
248            }
249
250            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
251            where
252                E: serde::de::Error,
253            {
254                i32::try_from(v)
255                    .ok()
256                    .and_then(|x| x.try_into().ok())
257                    .ok_or_else(|| {
258                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
259                    })
260            }
261
262            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
263            where
264                E: serde::de::Error,
265            {
266                match value {
267                    "UNSPECIFIED" => Ok(ArrayType::Unspecified),
268                    "INT16" => Ok(ArrayType::Int16),
269                    "INT32" => Ok(ArrayType::Int32),
270                    "INT64" => Ok(ArrayType::Int64),
271                    "FLOAT32" => Ok(ArrayType::Float32),
272                    "FLOAT64" => Ok(ArrayType::Float64),
273                    "UTF8" => Ok(ArrayType::Utf8),
274                    "BOOL" => Ok(ArrayType::Bool),
275                    "DECIMAL" => Ok(ArrayType::Decimal),
276                    "DATE" => Ok(ArrayType::Date),
277                    "TIME" => Ok(ArrayType::Time),
278                    "TIMESTAMP" => Ok(ArrayType::Timestamp),
279                    "TIMESTAMPTZ" => Ok(ArrayType::Timestamptz),
280                    "INTERVAL" => Ok(ArrayType::Interval),
281                    "STRUCT" => Ok(ArrayType::Struct),
282                    "LIST" => Ok(ArrayType::List),
283                    "BYTEA" => Ok(ArrayType::Bytea),
284                    "JSONB" => Ok(ArrayType::Jsonb),
285                    "SERIAL" => Ok(ArrayType::Serial),
286                    "INT256" => Ok(ArrayType::Int256),
287                    "MAP" => Ok(ArrayType::Map),
288                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
289                }
290            }
291        }
292        deserializer.deserialize_any(GeneratedVisitor)
293    }
294}
295impl serde::Serialize for DataChunk {
296    #[allow(deprecated)]
297    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
298    where
299        S: serde::Serializer,
300    {
301        use serde::ser::SerializeStruct;
302        let mut len = 0;
303        if self.cardinality != 0 {
304            len += 1;
305        }
306        if !self.columns.is_empty() {
307            len += 1;
308        }
309        let mut struct_ser = serializer.serialize_struct("data.DataChunk", len)?;
310        if self.cardinality != 0 {
311            struct_ser.serialize_field("cardinality", &self.cardinality)?;
312        }
313        if !self.columns.is_empty() {
314            struct_ser.serialize_field("columns", &self.columns)?;
315        }
316        struct_ser.end()
317    }
318}
319impl<'de> serde::Deserialize<'de> for DataChunk {
320    #[allow(deprecated)]
321    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
322    where
323        D: serde::Deserializer<'de>,
324    {
325        const FIELDS: &[&str] = &[
326            "cardinality",
327            "columns",
328        ];
329
330        #[allow(clippy::enum_variant_names)]
331        enum GeneratedField {
332            Cardinality,
333            Columns,
334        }
335        impl<'de> serde::Deserialize<'de> for GeneratedField {
336            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
337            where
338                D: serde::Deserializer<'de>,
339            {
340                struct GeneratedVisitor;
341
342                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
343                    type Value = GeneratedField;
344
345                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
346                        write!(formatter, "expected one of: {:?}", &FIELDS)
347                    }
348
349                    #[allow(unused_variables)]
350                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
351                    where
352                        E: serde::de::Error,
353                    {
354                        match value {
355                            "cardinality" => Ok(GeneratedField::Cardinality),
356                            "columns" => Ok(GeneratedField::Columns),
357                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
358                        }
359                    }
360                }
361                deserializer.deserialize_identifier(GeneratedVisitor)
362            }
363        }
364        struct GeneratedVisitor;
365        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
366            type Value = DataChunk;
367
368            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
369                formatter.write_str("struct data.DataChunk")
370            }
371
372            fn visit_map<V>(self, mut map_: V) -> std::result::Result<DataChunk, V::Error>
373                where
374                    V: serde::de::MapAccess<'de>,
375            {
376                let mut cardinality__ = None;
377                let mut columns__ = None;
378                while let Some(k) = map_.next_key()? {
379                    match k {
380                        GeneratedField::Cardinality => {
381                            if cardinality__.is_some() {
382                                return Err(serde::de::Error::duplicate_field("cardinality"));
383                            }
384                            cardinality__ = 
385                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
386                            ;
387                        }
388                        GeneratedField::Columns => {
389                            if columns__.is_some() {
390                                return Err(serde::de::Error::duplicate_field("columns"));
391                            }
392                            columns__ = Some(map_.next_value()?);
393                        }
394                    }
395                }
396                Ok(DataChunk {
397                    cardinality: cardinality__.unwrap_or_default(),
398                    columns: columns__.unwrap_or_default(),
399                })
400            }
401        }
402        deserializer.deserialize_struct("data.DataChunk", FIELDS, GeneratedVisitor)
403    }
404}
405impl serde::Serialize for DataType {
406    #[allow(deprecated)]
407    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
408    where
409        S: serde::Serializer,
410    {
411        use serde::ser::SerializeStruct;
412        let mut len = 0;
413        if self.type_name != 0 {
414            len += 1;
415        }
416        if self.precision != 0 {
417            len += 1;
418        }
419        if self.scale != 0 {
420            len += 1;
421        }
422        if self.is_nullable {
423            len += 1;
424        }
425        if self.interval_type != 0 {
426            len += 1;
427        }
428        if !self.field_type.is_empty() {
429            len += 1;
430        }
431        if !self.field_names.is_empty() {
432            len += 1;
433        }
434        if !self.field_ids.is_empty() {
435            len += 1;
436        }
437        let mut struct_ser = serializer.serialize_struct("data.DataType", len)?;
438        if self.type_name != 0 {
439            let v = data_type::TypeName::try_from(self.type_name)
440                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.type_name)))?;
441            struct_ser.serialize_field("typeName", &v)?;
442        }
443        if self.precision != 0 {
444            struct_ser.serialize_field("precision", &self.precision)?;
445        }
446        if self.scale != 0 {
447            struct_ser.serialize_field("scale", &self.scale)?;
448        }
449        if self.is_nullable {
450            struct_ser.serialize_field("isNullable", &self.is_nullable)?;
451        }
452        if self.interval_type != 0 {
453            let v = data_type::IntervalType::try_from(self.interval_type)
454                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.interval_type)))?;
455            struct_ser.serialize_field("intervalType", &v)?;
456        }
457        if !self.field_type.is_empty() {
458            struct_ser.serialize_field("fieldType", &self.field_type)?;
459        }
460        if !self.field_names.is_empty() {
461            struct_ser.serialize_field("fieldNames", &self.field_names)?;
462        }
463        if !self.field_ids.is_empty() {
464            struct_ser.serialize_field("fieldIds", &self.field_ids)?;
465        }
466        struct_ser.end()
467    }
468}
469impl<'de> serde::Deserialize<'de> for DataType {
470    #[allow(deprecated)]
471    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
472    where
473        D: serde::Deserializer<'de>,
474    {
475        const FIELDS: &[&str] = &[
476            "type_name",
477            "typeName",
478            "precision",
479            "scale",
480            "is_nullable",
481            "isNullable",
482            "interval_type",
483            "intervalType",
484            "field_type",
485            "fieldType",
486            "field_names",
487            "fieldNames",
488            "field_ids",
489            "fieldIds",
490        ];
491
492        #[allow(clippy::enum_variant_names)]
493        enum GeneratedField {
494            TypeName,
495            Precision,
496            Scale,
497            IsNullable,
498            IntervalType,
499            FieldType,
500            FieldNames,
501            FieldIds,
502        }
503        impl<'de> serde::Deserialize<'de> for GeneratedField {
504            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
505            where
506                D: serde::Deserializer<'de>,
507            {
508                struct GeneratedVisitor;
509
510                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
511                    type Value = GeneratedField;
512
513                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
514                        write!(formatter, "expected one of: {:?}", &FIELDS)
515                    }
516
517                    #[allow(unused_variables)]
518                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
519                    where
520                        E: serde::de::Error,
521                    {
522                        match value {
523                            "typeName" | "type_name" => Ok(GeneratedField::TypeName),
524                            "precision" => Ok(GeneratedField::Precision),
525                            "scale" => Ok(GeneratedField::Scale),
526                            "isNullable" | "is_nullable" => Ok(GeneratedField::IsNullable),
527                            "intervalType" | "interval_type" => Ok(GeneratedField::IntervalType),
528                            "fieldType" | "field_type" => Ok(GeneratedField::FieldType),
529                            "fieldNames" | "field_names" => Ok(GeneratedField::FieldNames),
530                            "fieldIds" | "field_ids" => Ok(GeneratedField::FieldIds),
531                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
532                        }
533                    }
534                }
535                deserializer.deserialize_identifier(GeneratedVisitor)
536            }
537        }
538        struct GeneratedVisitor;
539        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
540            type Value = DataType;
541
542            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
543                formatter.write_str("struct data.DataType")
544            }
545
546            fn visit_map<V>(self, mut map_: V) -> std::result::Result<DataType, V::Error>
547                where
548                    V: serde::de::MapAccess<'de>,
549            {
550                let mut type_name__ = None;
551                let mut precision__ = None;
552                let mut scale__ = None;
553                let mut is_nullable__ = None;
554                let mut interval_type__ = None;
555                let mut field_type__ = None;
556                let mut field_names__ = None;
557                let mut field_ids__ = None;
558                while let Some(k) = map_.next_key()? {
559                    match k {
560                        GeneratedField::TypeName => {
561                            if type_name__.is_some() {
562                                return Err(serde::de::Error::duplicate_field("typeName"));
563                            }
564                            type_name__ = Some(map_.next_value::<data_type::TypeName>()? as i32);
565                        }
566                        GeneratedField::Precision => {
567                            if precision__.is_some() {
568                                return Err(serde::de::Error::duplicate_field("precision"));
569                            }
570                            precision__ = 
571                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
572                            ;
573                        }
574                        GeneratedField::Scale => {
575                            if scale__.is_some() {
576                                return Err(serde::de::Error::duplicate_field("scale"));
577                            }
578                            scale__ = 
579                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
580                            ;
581                        }
582                        GeneratedField::IsNullable => {
583                            if is_nullable__.is_some() {
584                                return Err(serde::de::Error::duplicate_field("isNullable"));
585                            }
586                            is_nullable__ = Some(map_.next_value()?);
587                        }
588                        GeneratedField::IntervalType => {
589                            if interval_type__.is_some() {
590                                return Err(serde::de::Error::duplicate_field("intervalType"));
591                            }
592                            interval_type__ = Some(map_.next_value::<data_type::IntervalType>()? as i32);
593                        }
594                        GeneratedField::FieldType => {
595                            if field_type__.is_some() {
596                                return Err(serde::de::Error::duplicate_field("fieldType"));
597                            }
598                            field_type__ = Some(map_.next_value()?);
599                        }
600                        GeneratedField::FieldNames => {
601                            if field_names__.is_some() {
602                                return Err(serde::de::Error::duplicate_field("fieldNames"));
603                            }
604                            field_names__ = Some(map_.next_value()?);
605                        }
606                        GeneratedField::FieldIds => {
607                            if field_ids__.is_some() {
608                                return Err(serde::de::Error::duplicate_field("fieldIds"));
609                            }
610                            field_ids__ = 
611                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
612                                    .into_iter().map(|x| x.0).collect())
613                            ;
614                        }
615                    }
616                }
617                Ok(DataType {
618                    type_name: type_name__.unwrap_or_default(),
619                    precision: precision__.unwrap_or_default(),
620                    scale: scale__.unwrap_or_default(),
621                    is_nullable: is_nullable__.unwrap_or_default(),
622                    interval_type: interval_type__.unwrap_or_default(),
623                    field_type: field_type__.unwrap_or_default(),
624                    field_names: field_names__.unwrap_or_default(),
625                    field_ids: field_ids__.unwrap_or_default(),
626                })
627            }
628        }
629        deserializer.deserialize_struct("data.DataType", FIELDS, GeneratedVisitor)
630    }
631}
632impl serde::Serialize for data_type::IntervalType {
633    #[allow(deprecated)]
634    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
635    where
636        S: serde::Serializer,
637    {
638        let variant = match self {
639            Self::Unspecified => "UNSPECIFIED",
640            Self::Year => "YEAR",
641            Self::Month => "MONTH",
642            Self::Day => "DAY",
643            Self::Hour => "HOUR",
644            Self::Minute => "MINUTE",
645            Self::Second => "SECOND",
646            Self::YearToMonth => "YEAR_TO_MONTH",
647            Self::DayToHour => "DAY_TO_HOUR",
648            Self::DayToMinute => "DAY_TO_MINUTE",
649            Self::DayToSecond => "DAY_TO_SECOND",
650            Self::HourToMinute => "HOUR_TO_MINUTE",
651            Self::HourToSecond => "HOUR_TO_SECOND",
652            Self::MinuteToSecond => "MINUTE_TO_SECOND",
653        };
654        serializer.serialize_str(variant)
655    }
656}
657impl<'de> serde::Deserialize<'de> for data_type::IntervalType {
658    #[allow(deprecated)]
659    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
660    where
661        D: serde::Deserializer<'de>,
662    {
663        const FIELDS: &[&str] = &[
664            "UNSPECIFIED",
665            "YEAR",
666            "MONTH",
667            "DAY",
668            "HOUR",
669            "MINUTE",
670            "SECOND",
671            "YEAR_TO_MONTH",
672            "DAY_TO_HOUR",
673            "DAY_TO_MINUTE",
674            "DAY_TO_SECOND",
675            "HOUR_TO_MINUTE",
676            "HOUR_TO_SECOND",
677            "MINUTE_TO_SECOND",
678        ];
679
680        struct GeneratedVisitor;
681
682        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
683            type Value = data_type::IntervalType;
684
685            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
686                write!(formatter, "expected one of: {:?}", &FIELDS)
687            }
688
689            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
690            where
691                E: serde::de::Error,
692            {
693                i32::try_from(v)
694                    .ok()
695                    .and_then(|x| x.try_into().ok())
696                    .ok_or_else(|| {
697                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
698                    })
699            }
700
701            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
702            where
703                E: serde::de::Error,
704            {
705                i32::try_from(v)
706                    .ok()
707                    .and_then(|x| x.try_into().ok())
708                    .ok_or_else(|| {
709                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
710                    })
711            }
712
713            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
714            where
715                E: serde::de::Error,
716            {
717                match value {
718                    "UNSPECIFIED" => Ok(data_type::IntervalType::Unspecified),
719                    "YEAR" => Ok(data_type::IntervalType::Year),
720                    "MONTH" => Ok(data_type::IntervalType::Month),
721                    "DAY" => Ok(data_type::IntervalType::Day),
722                    "HOUR" => Ok(data_type::IntervalType::Hour),
723                    "MINUTE" => Ok(data_type::IntervalType::Minute),
724                    "SECOND" => Ok(data_type::IntervalType::Second),
725                    "YEAR_TO_MONTH" => Ok(data_type::IntervalType::YearToMonth),
726                    "DAY_TO_HOUR" => Ok(data_type::IntervalType::DayToHour),
727                    "DAY_TO_MINUTE" => Ok(data_type::IntervalType::DayToMinute),
728                    "DAY_TO_SECOND" => Ok(data_type::IntervalType::DayToSecond),
729                    "HOUR_TO_MINUTE" => Ok(data_type::IntervalType::HourToMinute),
730                    "HOUR_TO_SECOND" => Ok(data_type::IntervalType::HourToSecond),
731                    "MINUTE_TO_SECOND" => Ok(data_type::IntervalType::MinuteToSecond),
732                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
733                }
734            }
735        }
736        deserializer.deserialize_any(GeneratedVisitor)
737    }
738}
739impl serde::Serialize for data_type::TypeName {
740    #[allow(deprecated)]
741    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
742    where
743        S: serde::Serializer,
744    {
745        let variant = match self {
746            Self::TypeUnspecified => "TYPE_UNSPECIFIED",
747            Self::Int16 => "INT16",
748            Self::Int32 => "INT32",
749            Self::Int64 => "INT64",
750            Self::Float => "FLOAT",
751            Self::Double => "DOUBLE",
752            Self::Boolean => "BOOLEAN",
753            Self::Varchar => "VARCHAR",
754            Self::Decimal => "DECIMAL",
755            Self::Time => "TIME",
756            Self::Timestamp => "TIMESTAMP",
757            Self::Interval => "INTERVAL",
758            Self::Date => "DATE",
759            Self::Timestamptz => "TIMESTAMPTZ",
760            Self::Struct => "STRUCT",
761            Self::List => "LIST",
762            Self::Bytea => "BYTEA",
763            Self::Jsonb => "JSONB",
764            Self::Serial => "SERIAL",
765            Self::Int256 => "INT256",
766            Self::Map => "MAP",
767        };
768        serializer.serialize_str(variant)
769    }
770}
771impl<'de> serde::Deserialize<'de> for data_type::TypeName {
772    #[allow(deprecated)]
773    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
774    where
775        D: serde::Deserializer<'de>,
776    {
777        const FIELDS: &[&str] = &[
778            "TYPE_UNSPECIFIED",
779            "INT16",
780            "INT32",
781            "INT64",
782            "FLOAT",
783            "DOUBLE",
784            "BOOLEAN",
785            "VARCHAR",
786            "DECIMAL",
787            "TIME",
788            "TIMESTAMP",
789            "INTERVAL",
790            "DATE",
791            "TIMESTAMPTZ",
792            "STRUCT",
793            "LIST",
794            "BYTEA",
795            "JSONB",
796            "SERIAL",
797            "INT256",
798            "MAP",
799        ];
800
801        struct GeneratedVisitor;
802
803        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
804            type Value = data_type::TypeName;
805
806            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
807                write!(formatter, "expected one of: {:?}", &FIELDS)
808            }
809
810            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
811            where
812                E: serde::de::Error,
813            {
814                i32::try_from(v)
815                    .ok()
816                    .and_then(|x| x.try_into().ok())
817                    .ok_or_else(|| {
818                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
819                    })
820            }
821
822            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
823            where
824                E: serde::de::Error,
825            {
826                i32::try_from(v)
827                    .ok()
828                    .and_then(|x| x.try_into().ok())
829                    .ok_or_else(|| {
830                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
831                    })
832            }
833
834            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
835            where
836                E: serde::de::Error,
837            {
838                match value {
839                    "TYPE_UNSPECIFIED" => Ok(data_type::TypeName::TypeUnspecified),
840                    "INT16" => Ok(data_type::TypeName::Int16),
841                    "INT32" => Ok(data_type::TypeName::Int32),
842                    "INT64" => Ok(data_type::TypeName::Int64),
843                    "FLOAT" => Ok(data_type::TypeName::Float),
844                    "DOUBLE" => Ok(data_type::TypeName::Double),
845                    "BOOLEAN" => Ok(data_type::TypeName::Boolean),
846                    "VARCHAR" => Ok(data_type::TypeName::Varchar),
847                    "DECIMAL" => Ok(data_type::TypeName::Decimal),
848                    "TIME" => Ok(data_type::TypeName::Time),
849                    "TIMESTAMP" => Ok(data_type::TypeName::Timestamp),
850                    "INTERVAL" => Ok(data_type::TypeName::Interval),
851                    "DATE" => Ok(data_type::TypeName::Date),
852                    "TIMESTAMPTZ" => Ok(data_type::TypeName::Timestamptz),
853                    "STRUCT" => Ok(data_type::TypeName::Struct),
854                    "LIST" => Ok(data_type::TypeName::List),
855                    "BYTEA" => Ok(data_type::TypeName::Bytea),
856                    "JSONB" => Ok(data_type::TypeName::Jsonb),
857                    "SERIAL" => Ok(data_type::TypeName::Serial),
858                    "INT256" => Ok(data_type::TypeName::Int256),
859                    "MAP" => Ok(data_type::TypeName::Map),
860                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
861                }
862            }
863        }
864        deserializer.deserialize_any(GeneratedVisitor)
865    }
866}
867impl serde::Serialize for Datum {
868    #[allow(deprecated)]
869    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
870    where
871        S: serde::Serializer,
872    {
873        use serde::ser::SerializeStruct;
874        let mut len = 0;
875        if !self.body.is_empty() {
876            len += 1;
877        }
878        let mut struct_ser = serializer.serialize_struct("data.Datum", len)?;
879        if !self.body.is_empty() {
880            #[allow(clippy::needless_borrow)]
881            #[allow(clippy::needless_borrows_for_generic_args)]
882            struct_ser.serialize_field("body", pbjson::private::base64::encode(&self.body).as_str())?;
883        }
884        struct_ser.end()
885    }
886}
887impl<'de> serde::Deserialize<'de> for Datum {
888    #[allow(deprecated)]
889    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
890    where
891        D: serde::Deserializer<'de>,
892    {
893        const FIELDS: &[&str] = &[
894            "body",
895        ];
896
897        #[allow(clippy::enum_variant_names)]
898        enum GeneratedField {
899            Body,
900        }
901        impl<'de> serde::Deserialize<'de> for GeneratedField {
902            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
903            where
904                D: serde::Deserializer<'de>,
905            {
906                struct GeneratedVisitor;
907
908                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
909                    type Value = GeneratedField;
910
911                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
912                        write!(formatter, "expected one of: {:?}", &FIELDS)
913                    }
914
915                    #[allow(unused_variables)]
916                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
917                    where
918                        E: serde::de::Error,
919                    {
920                        match value {
921                            "body" => Ok(GeneratedField::Body),
922                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
923                        }
924                    }
925                }
926                deserializer.deserialize_identifier(GeneratedVisitor)
927            }
928        }
929        struct GeneratedVisitor;
930        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
931            type Value = Datum;
932
933            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
934                formatter.write_str("struct data.Datum")
935            }
936
937            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Datum, V::Error>
938                where
939                    V: serde::de::MapAccess<'de>,
940            {
941                let mut body__ = None;
942                while let Some(k) = map_.next_key()? {
943                    match k {
944                        GeneratedField::Body => {
945                            if body__.is_some() {
946                                return Err(serde::de::Error::duplicate_field("body"));
947                            }
948                            body__ = 
949                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
950                            ;
951                        }
952                    }
953                }
954                Ok(Datum {
955                    body: body__.unwrap_or_default(),
956                })
957            }
958        }
959        deserializer.deserialize_struct("data.Datum", FIELDS, GeneratedVisitor)
960    }
961}
962impl serde::Serialize for Epoch {
963    #[allow(deprecated)]
964    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
965    where
966        S: serde::Serializer,
967    {
968        use serde::ser::SerializeStruct;
969        let mut len = 0;
970        if self.curr != 0 {
971            len += 1;
972        }
973        if self.prev != 0 {
974            len += 1;
975        }
976        let mut struct_ser = serializer.serialize_struct("data.Epoch", len)?;
977        if self.curr != 0 {
978            #[allow(clippy::needless_borrow)]
979            #[allow(clippy::needless_borrows_for_generic_args)]
980            struct_ser.serialize_field("curr", ToString::to_string(&self.curr).as_str())?;
981        }
982        if self.prev != 0 {
983            #[allow(clippy::needless_borrow)]
984            #[allow(clippy::needless_borrows_for_generic_args)]
985            struct_ser.serialize_field("prev", ToString::to_string(&self.prev).as_str())?;
986        }
987        struct_ser.end()
988    }
989}
990impl<'de> serde::Deserialize<'de> for Epoch {
991    #[allow(deprecated)]
992    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
993    where
994        D: serde::Deserializer<'de>,
995    {
996        const FIELDS: &[&str] = &[
997            "curr",
998            "prev",
999        ];
1000
1001        #[allow(clippy::enum_variant_names)]
1002        enum GeneratedField {
1003            Curr,
1004            Prev,
1005        }
1006        impl<'de> serde::Deserialize<'de> for GeneratedField {
1007            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1008            where
1009                D: serde::Deserializer<'de>,
1010            {
1011                struct GeneratedVisitor;
1012
1013                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1014                    type Value = GeneratedField;
1015
1016                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1017                        write!(formatter, "expected one of: {:?}", &FIELDS)
1018                    }
1019
1020                    #[allow(unused_variables)]
1021                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1022                    where
1023                        E: serde::de::Error,
1024                    {
1025                        match value {
1026                            "curr" => Ok(GeneratedField::Curr),
1027                            "prev" => Ok(GeneratedField::Prev),
1028                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1029                        }
1030                    }
1031                }
1032                deserializer.deserialize_identifier(GeneratedVisitor)
1033            }
1034        }
1035        struct GeneratedVisitor;
1036        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1037            type Value = Epoch;
1038
1039            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1040                formatter.write_str("struct data.Epoch")
1041            }
1042
1043            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Epoch, V::Error>
1044                where
1045                    V: serde::de::MapAccess<'de>,
1046            {
1047                let mut curr__ = None;
1048                let mut prev__ = None;
1049                while let Some(k) = map_.next_key()? {
1050                    match k {
1051                        GeneratedField::Curr => {
1052                            if curr__.is_some() {
1053                                return Err(serde::de::Error::duplicate_field("curr"));
1054                            }
1055                            curr__ = 
1056                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1057                            ;
1058                        }
1059                        GeneratedField::Prev => {
1060                            if prev__.is_some() {
1061                                return Err(serde::de::Error::duplicate_field("prev"));
1062                            }
1063                            prev__ = 
1064                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1065                            ;
1066                        }
1067                    }
1068                }
1069                Ok(Epoch {
1070                    curr: curr__.unwrap_or_default(),
1071                    prev: prev__.unwrap_or_default(),
1072                })
1073            }
1074        }
1075        deserializer.deserialize_struct("data.Epoch", FIELDS, GeneratedVisitor)
1076    }
1077}
1078impl serde::Serialize for Interval {
1079    #[allow(deprecated)]
1080    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1081    where
1082        S: serde::Serializer,
1083    {
1084        use serde::ser::SerializeStruct;
1085        let mut len = 0;
1086        if self.months != 0 {
1087            len += 1;
1088        }
1089        if self.days != 0 {
1090            len += 1;
1091        }
1092        if self.usecs != 0 {
1093            len += 1;
1094        }
1095        let mut struct_ser = serializer.serialize_struct("data.Interval", len)?;
1096        if self.months != 0 {
1097            struct_ser.serialize_field("months", &self.months)?;
1098        }
1099        if self.days != 0 {
1100            struct_ser.serialize_field("days", &self.days)?;
1101        }
1102        if self.usecs != 0 {
1103            #[allow(clippy::needless_borrow)]
1104            #[allow(clippy::needless_borrows_for_generic_args)]
1105            struct_ser.serialize_field("usecs", ToString::to_string(&self.usecs).as_str())?;
1106        }
1107        struct_ser.end()
1108    }
1109}
1110impl<'de> serde::Deserialize<'de> for Interval {
1111    #[allow(deprecated)]
1112    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1113    where
1114        D: serde::Deserializer<'de>,
1115    {
1116        const FIELDS: &[&str] = &[
1117            "months",
1118            "days",
1119            "usecs",
1120        ];
1121
1122        #[allow(clippy::enum_variant_names)]
1123        enum GeneratedField {
1124            Months,
1125            Days,
1126            Usecs,
1127        }
1128        impl<'de> serde::Deserialize<'de> for GeneratedField {
1129            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1130            where
1131                D: serde::Deserializer<'de>,
1132            {
1133                struct GeneratedVisitor;
1134
1135                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1136                    type Value = GeneratedField;
1137
1138                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1139                        write!(formatter, "expected one of: {:?}", &FIELDS)
1140                    }
1141
1142                    #[allow(unused_variables)]
1143                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1144                    where
1145                        E: serde::de::Error,
1146                    {
1147                        match value {
1148                            "months" => Ok(GeneratedField::Months),
1149                            "days" => Ok(GeneratedField::Days),
1150                            "usecs" => Ok(GeneratedField::Usecs),
1151                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1152                        }
1153                    }
1154                }
1155                deserializer.deserialize_identifier(GeneratedVisitor)
1156            }
1157        }
1158        struct GeneratedVisitor;
1159        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1160            type Value = Interval;
1161
1162            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1163                formatter.write_str("struct data.Interval")
1164            }
1165
1166            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Interval, V::Error>
1167                where
1168                    V: serde::de::MapAccess<'de>,
1169            {
1170                let mut months__ = None;
1171                let mut days__ = None;
1172                let mut usecs__ = None;
1173                while let Some(k) = map_.next_key()? {
1174                    match k {
1175                        GeneratedField::Months => {
1176                            if months__.is_some() {
1177                                return Err(serde::de::Error::duplicate_field("months"));
1178                            }
1179                            months__ = 
1180                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1181                            ;
1182                        }
1183                        GeneratedField::Days => {
1184                            if days__.is_some() {
1185                                return Err(serde::de::Error::duplicate_field("days"));
1186                            }
1187                            days__ = 
1188                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1189                            ;
1190                        }
1191                        GeneratedField::Usecs => {
1192                            if usecs__.is_some() {
1193                                return Err(serde::de::Error::duplicate_field("usecs"));
1194                            }
1195                            usecs__ = 
1196                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1197                            ;
1198                        }
1199                    }
1200                }
1201                Ok(Interval {
1202                    months: months__.unwrap_or_default(),
1203                    days: days__.unwrap_or_default(),
1204                    usecs: usecs__.unwrap_or_default(),
1205                })
1206            }
1207        }
1208        deserializer.deserialize_struct("data.Interval", FIELDS, GeneratedVisitor)
1209    }
1210}
1211impl serde::Serialize for ListArrayData {
1212    #[allow(deprecated)]
1213    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1214    where
1215        S: serde::Serializer,
1216    {
1217        use serde::ser::SerializeStruct;
1218        let mut len = 0;
1219        if !self.offsets.is_empty() {
1220            len += 1;
1221        }
1222        if self.value.is_some() {
1223            len += 1;
1224        }
1225        if self.value_type.is_some() {
1226            len += 1;
1227        }
1228        let mut struct_ser = serializer.serialize_struct("data.ListArrayData", len)?;
1229        if !self.offsets.is_empty() {
1230            struct_ser.serialize_field("offsets", &self.offsets)?;
1231        }
1232        if let Some(v) = self.value.as_ref() {
1233            struct_ser.serialize_field("value", v)?;
1234        }
1235        if let Some(v) = self.value_type.as_ref() {
1236            struct_ser.serialize_field("valueType", v)?;
1237        }
1238        struct_ser.end()
1239    }
1240}
1241impl<'de> serde::Deserialize<'de> for ListArrayData {
1242    #[allow(deprecated)]
1243    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1244    where
1245        D: serde::Deserializer<'de>,
1246    {
1247        const FIELDS: &[&str] = &[
1248            "offsets",
1249            "value",
1250            "value_type",
1251            "valueType",
1252        ];
1253
1254        #[allow(clippy::enum_variant_names)]
1255        enum GeneratedField {
1256            Offsets,
1257            Value,
1258            ValueType,
1259        }
1260        impl<'de> serde::Deserialize<'de> for GeneratedField {
1261            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1262            where
1263                D: serde::Deserializer<'de>,
1264            {
1265                struct GeneratedVisitor;
1266
1267                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1268                    type Value = GeneratedField;
1269
1270                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1271                        write!(formatter, "expected one of: {:?}", &FIELDS)
1272                    }
1273
1274                    #[allow(unused_variables)]
1275                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1276                    where
1277                        E: serde::de::Error,
1278                    {
1279                        match value {
1280                            "offsets" => Ok(GeneratedField::Offsets),
1281                            "value" => Ok(GeneratedField::Value),
1282                            "valueType" | "value_type" => Ok(GeneratedField::ValueType),
1283                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1284                        }
1285                    }
1286                }
1287                deserializer.deserialize_identifier(GeneratedVisitor)
1288            }
1289        }
1290        struct GeneratedVisitor;
1291        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1292            type Value = ListArrayData;
1293
1294            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1295                formatter.write_str("struct data.ListArrayData")
1296            }
1297
1298            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ListArrayData, V::Error>
1299                where
1300                    V: serde::de::MapAccess<'de>,
1301            {
1302                let mut offsets__ = None;
1303                let mut value__ = None;
1304                let mut value_type__ = None;
1305                while let Some(k) = map_.next_key()? {
1306                    match k {
1307                        GeneratedField::Offsets => {
1308                            if offsets__.is_some() {
1309                                return Err(serde::de::Error::duplicate_field("offsets"));
1310                            }
1311                            offsets__ = 
1312                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
1313                                    .into_iter().map(|x| x.0).collect())
1314                            ;
1315                        }
1316                        GeneratedField::Value => {
1317                            if value__.is_some() {
1318                                return Err(serde::de::Error::duplicate_field("value"));
1319                            }
1320                            value__ = map_.next_value()?;
1321                        }
1322                        GeneratedField::ValueType => {
1323                            if value_type__.is_some() {
1324                                return Err(serde::de::Error::duplicate_field("valueType"));
1325                            }
1326                            value_type__ = map_.next_value()?;
1327                        }
1328                    }
1329                }
1330                Ok(ListArrayData {
1331                    offsets: offsets__.unwrap_or_default(),
1332                    value: value__,
1333                    value_type: value_type__,
1334                })
1335            }
1336        }
1337        deserializer.deserialize_struct("data.ListArrayData", FIELDS, GeneratedVisitor)
1338    }
1339}
1340impl serde::Serialize for Op {
1341    #[allow(deprecated)]
1342    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1343    where
1344        S: serde::Serializer,
1345    {
1346        let variant = match self {
1347            Self::Unspecified => "OP_UNSPECIFIED",
1348            Self::Insert => "INSERT",
1349            Self::Delete => "DELETE",
1350            Self::UpdateInsert => "UPDATE_INSERT",
1351            Self::UpdateDelete => "UPDATE_DELETE",
1352        };
1353        serializer.serialize_str(variant)
1354    }
1355}
1356impl<'de> serde::Deserialize<'de> for Op {
1357    #[allow(deprecated)]
1358    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1359    where
1360        D: serde::Deserializer<'de>,
1361    {
1362        const FIELDS: &[&str] = &[
1363            "OP_UNSPECIFIED",
1364            "INSERT",
1365            "DELETE",
1366            "UPDATE_INSERT",
1367            "UPDATE_DELETE",
1368        ];
1369
1370        struct GeneratedVisitor;
1371
1372        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1373            type Value = Op;
1374
1375            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1376                write!(formatter, "expected one of: {:?}", &FIELDS)
1377            }
1378
1379            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
1380            where
1381                E: serde::de::Error,
1382            {
1383                i32::try_from(v)
1384                    .ok()
1385                    .and_then(|x| x.try_into().ok())
1386                    .ok_or_else(|| {
1387                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
1388                    })
1389            }
1390
1391            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
1392            where
1393                E: serde::de::Error,
1394            {
1395                i32::try_from(v)
1396                    .ok()
1397                    .and_then(|x| x.try_into().ok())
1398                    .ok_or_else(|| {
1399                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
1400                    })
1401            }
1402
1403            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1404            where
1405                E: serde::de::Error,
1406            {
1407                match value {
1408                    "OP_UNSPECIFIED" => Ok(Op::Unspecified),
1409                    "INSERT" => Ok(Op::Insert),
1410                    "DELETE" => Ok(Op::Delete),
1411                    "UPDATE_INSERT" => Ok(Op::UpdateInsert),
1412                    "UPDATE_DELETE" => Ok(Op::UpdateDelete),
1413                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
1414                }
1415            }
1416        }
1417        deserializer.deserialize_any(GeneratedVisitor)
1418    }
1419}
1420impl serde::Serialize for StreamChunk {
1421    #[allow(deprecated)]
1422    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1423    where
1424        S: serde::Serializer,
1425    {
1426        use serde::ser::SerializeStruct;
1427        let mut len = 0;
1428        if self.cardinality != 0 {
1429            len += 1;
1430        }
1431        if !self.ops.is_empty() {
1432            len += 1;
1433        }
1434        if !self.columns.is_empty() {
1435            len += 1;
1436        }
1437        let mut struct_ser = serializer.serialize_struct("data.StreamChunk", len)?;
1438        if self.cardinality != 0 {
1439            struct_ser.serialize_field("cardinality", &self.cardinality)?;
1440        }
1441        if !self.ops.is_empty() {
1442            let v = self.ops.iter().cloned().map(|v| {
1443                Op::try_from(v)
1444                    .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v)))
1445                }).collect::<std::result::Result<Vec<_>, _>>()?;
1446            struct_ser.serialize_field("ops", &v)?;
1447        }
1448        if !self.columns.is_empty() {
1449            struct_ser.serialize_field("columns", &self.columns)?;
1450        }
1451        struct_ser.end()
1452    }
1453}
1454impl<'de> serde::Deserialize<'de> for StreamChunk {
1455    #[allow(deprecated)]
1456    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1457    where
1458        D: serde::Deserializer<'de>,
1459    {
1460        const FIELDS: &[&str] = &[
1461            "cardinality",
1462            "ops",
1463            "columns",
1464        ];
1465
1466        #[allow(clippy::enum_variant_names)]
1467        enum GeneratedField {
1468            Cardinality,
1469            Ops,
1470            Columns,
1471        }
1472        impl<'de> serde::Deserialize<'de> for GeneratedField {
1473            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1474            where
1475                D: serde::Deserializer<'de>,
1476            {
1477                struct GeneratedVisitor;
1478
1479                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1480                    type Value = GeneratedField;
1481
1482                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1483                        write!(formatter, "expected one of: {:?}", &FIELDS)
1484                    }
1485
1486                    #[allow(unused_variables)]
1487                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1488                    where
1489                        E: serde::de::Error,
1490                    {
1491                        match value {
1492                            "cardinality" => Ok(GeneratedField::Cardinality),
1493                            "ops" => Ok(GeneratedField::Ops),
1494                            "columns" => Ok(GeneratedField::Columns),
1495                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1496                        }
1497                    }
1498                }
1499                deserializer.deserialize_identifier(GeneratedVisitor)
1500            }
1501        }
1502        struct GeneratedVisitor;
1503        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1504            type Value = StreamChunk;
1505
1506            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1507                formatter.write_str("struct data.StreamChunk")
1508            }
1509
1510            fn visit_map<V>(self, mut map_: V) -> std::result::Result<StreamChunk, V::Error>
1511                where
1512                    V: serde::de::MapAccess<'de>,
1513            {
1514                let mut cardinality__ = None;
1515                let mut ops__ = None;
1516                let mut columns__ = None;
1517                while let Some(k) = map_.next_key()? {
1518                    match k {
1519                        GeneratedField::Cardinality => {
1520                            if cardinality__.is_some() {
1521                                return Err(serde::de::Error::duplicate_field("cardinality"));
1522                            }
1523                            cardinality__ = 
1524                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1525                            ;
1526                        }
1527                        GeneratedField::Ops => {
1528                            if ops__.is_some() {
1529                                return Err(serde::de::Error::duplicate_field("ops"));
1530                            }
1531                            ops__ = Some(map_.next_value::<Vec<Op>>()?.into_iter().map(|x| x as i32).collect());
1532                        }
1533                        GeneratedField::Columns => {
1534                            if columns__.is_some() {
1535                                return Err(serde::de::Error::duplicate_field("columns"));
1536                            }
1537                            columns__ = Some(map_.next_value()?);
1538                        }
1539                    }
1540                }
1541                Ok(StreamChunk {
1542                    cardinality: cardinality__.unwrap_or_default(),
1543                    ops: ops__.unwrap_or_default(),
1544                    columns: columns__.unwrap_or_default(),
1545                })
1546            }
1547        }
1548        deserializer.deserialize_struct("data.StreamChunk", FIELDS, GeneratedVisitor)
1549    }
1550}
1551impl serde::Serialize for StructArrayData {
1552    #[allow(deprecated)]
1553    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1554    where
1555        S: serde::Serializer,
1556    {
1557        use serde::ser::SerializeStruct;
1558        let mut len = 0;
1559        if !self.children_array.is_empty() {
1560            len += 1;
1561        }
1562        if !self.children_type.is_empty() {
1563            len += 1;
1564        }
1565        let mut struct_ser = serializer.serialize_struct("data.StructArrayData", len)?;
1566        if !self.children_array.is_empty() {
1567            struct_ser.serialize_field("childrenArray", &self.children_array)?;
1568        }
1569        if !self.children_type.is_empty() {
1570            struct_ser.serialize_field("childrenType", &self.children_type)?;
1571        }
1572        struct_ser.end()
1573    }
1574}
1575impl<'de> serde::Deserialize<'de> for StructArrayData {
1576    #[allow(deprecated)]
1577    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1578    where
1579        D: serde::Deserializer<'de>,
1580    {
1581        const FIELDS: &[&str] = &[
1582            "children_array",
1583            "childrenArray",
1584            "children_type",
1585            "childrenType",
1586        ];
1587
1588        #[allow(clippy::enum_variant_names)]
1589        enum GeneratedField {
1590            ChildrenArray,
1591            ChildrenType,
1592        }
1593        impl<'de> serde::Deserialize<'de> for GeneratedField {
1594            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1595            where
1596                D: serde::Deserializer<'de>,
1597            {
1598                struct GeneratedVisitor;
1599
1600                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1601                    type Value = GeneratedField;
1602
1603                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1604                        write!(formatter, "expected one of: {:?}", &FIELDS)
1605                    }
1606
1607                    #[allow(unused_variables)]
1608                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1609                    where
1610                        E: serde::de::Error,
1611                    {
1612                        match value {
1613                            "childrenArray" | "children_array" => Ok(GeneratedField::ChildrenArray),
1614                            "childrenType" | "children_type" => Ok(GeneratedField::ChildrenType),
1615                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1616                        }
1617                    }
1618                }
1619                deserializer.deserialize_identifier(GeneratedVisitor)
1620            }
1621        }
1622        struct GeneratedVisitor;
1623        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1624            type Value = StructArrayData;
1625
1626            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1627                formatter.write_str("struct data.StructArrayData")
1628            }
1629
1630            fn visit_map<V>(self, mut map_: V) -> std::result::Result<StructArrayData, V::Error>
1631                where
1632                    V: serde::de::MapAccess<'de>,
1633            {
1634                let mut children_array__ = None;
1635                let mut children_type__ = None;
1636                while let Some(k) = map_.next_key()? {
1637                    match k {
1638                        GeneratedField::ChildrenArray => {
1639                            if children_array__.is_some() {
1640                                return Err(serde::de::Error::duplicate_field("childrenArray"));
1641                            }
1642                            children_array__ = Some(map_.next_value()?);
1643                        }
1644                        GeneratedField::ChildrenType => {
1645                            if children_type__.is_some() {
1646                                return Err(serde::de::Error::duplicate_field("childrenType"));
1647                            }
1648                            children_type__ = Some(map_.next_value()?);
1649                        }
1650                    }
1651                }
1652                Ok(StructArrayData {
1653                    children_array: children_array__.unwrap_or_default(),
1654                    children_type: children_type__.unwrap_or_default(),
1655                })
1656            }
1657        }
1658        deserializer.deserialize_struct("data.StructArrayData", FIELDS, GeneratedVisitor)
1659    }
1660}
1661impl serde::Serialize for Terminate {
1662    #[allow(deprecated)]
1663    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1664    where
1665        S: serde::Serializer,
1666    {
1667        use serde::ser::SerializeStruct;
1668        let len = 0;
1669        let struct_ser = serializer.serialize_struct("data.Terminate", len)?;
1670        struct_ser.end()
1671    }
1672}
1673impl<'de> serde::Deserialize<'de> for Terminate {
1674    #[allow(deprecated)]
1675    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1676    where
1677        D: serde::Deserializer<'de>,
1678    {
1679        const FIELDS: &[&str] = &[
1680        ];
1681
1682        #[allow(clippy::enum_variant_names)]
1683        enum GeneratedField {
1684        }
1685        impl<'de> serde::Deserialize<'de> for GeneratedField {
1686            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1687            where
1688                D: serde::Deserializer<'de>,
1689            {
1690                struct GeneratedVisitor;
1691
1692                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1693                    type Value = GeneratedField;
1694
1695                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1696                        write!(formatter, "expected one of: {:?}", &FIELDS)
1697                    }
1698
1699                    #[allow(unused_variables)]
1700                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1701                    where
1702                        E: serde::de::Error,
1703                    {
1704                            Err(serde::de::Error::unknown_field(value, FIELDS))
1705                    }
1706                }
1707                deserializer.deserialize_identifier(GeneratedVisitor)
1708            }
1709        }
1710        struct GeneratedVisitor;
1711        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1712            type Value = Terminate;
1713
1714            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1715                formatter.write_str("struct data.Terminate")
1716            }
1717
1718            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Terminate, V::Error>
1719                where
1720                    V: serde::de::MapAccess<'de>,
1721            {
1722                while map_.next_key::<GeneratedField>()?.is_some() {
1723                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
1724                }
1725                Ok(Terminate {
1726                })
1727            }
1728        }
1729        deserializer.deserialize_struct("data.Terminate", FIELDS, GeneratedVisitor)
1730    }
1731}