Skip to main content

exoware_sdk/gen/
store.v1.sql.rs

1// @generated by protoc-gen-buffa. DO NOT EDIT.
2// source: store/v1/sql.proto
3
4/// Key layout of a secondary index.
5#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
6#[repr(i32)]
7pub enum IndexLayout {
8    /// Standard lexicographic concatenation of key columns.
9    INDEX_LAYOUT_LEXICOGRAPHIC = 0i32,
10    /// Z-order (Morton) interleaving of the key columns' bits, for
11    /// multi-dimensional range scans.
12    INDEX_LAYOUT_Z_ORDER = 1i32,
13}
14impl ::core::default::Default for IndexLayout {
15    fn default() -> Self {
16        Self::INDEX_LAYOUT_LEXICOGRAPHIC
17    }
18}
19impl ::serde::Serialize for IndexLayout {
20    fn serialize<S: ::serde::Serializer>(
21        &self,
22        s: S,
23    ) -> ::core::result::Result<S::Ok, S::Error> {
24        s.serialize_str(::buffa::Enumeration::proto_name(self))
25    }
26}
27impl<'de> ::serde::Deserialize<'de> for IndexLayout {
28    fn deserialize<D: ::serde::Deserializer<'de>>(
29        d: D,
30    ) -> ::core::result::Result<Self, D::Error> {
31        struct _V;
32        impl ::serde::de::Visitor<'_> for _V {
33            type Value = IndexLayout;
34            fn expecting(
35                &self,
36                f: &mut ::core::fmt::Formatter<'_>,
37            ) -> ::core::fmt::Result {
38                f.write_str(
39                    concat!("a string, integer, or null for ", stringify!(IndexLayout)),
40                )
41            }
42            fn visit_str<E: ::serde::de::Error>(
43                self,
44                v: &str,
45            ) -> ::core::result::Result<IndexLayout, E> {
46                <IndexLayout as ::buffa::Enumeration>::from_proto_name(v)
47                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
48            }
49            fn visit_i64<E: ::serde::de::Error>(
50                self,
51                v: i64,
52            ) -> ::core::result::Result<IndexLayout, E> {
53                let v32 = i32::try_from(v)
54                    .map_err(|_| {
55                        ::serde::de::Error::custom(
56                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
57                        )
58                    })?;
59                <IndexLayout as ::buffa::Enumeration>::from_i32(v32)
60                    .ok_or_else(|| {
61                        ::serde::de::Error::custom(
62                            ::buffa::alloc::format!("unknown enum value {}", v32),
63                        )
64                    })
65            }
66            fn visit_u64<E: ::serde::de::Error>(
67                self,
68                v: u64,
69            ) -> ::core::result::Result<IndexLayout, E> {
70                let v32 = i32::try_from(v)
71                    .map_err(|_| {
72                        ::serde::de::Error::custom(
73                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
74                        )
75                    })?;
76                <IndexLayout as ::buffa::Enumeration>::from_i32(v32)
77                    .ok_or_else(|| {
78                        ::serde::de::Error::custom(
79                            ::buffa::alloc::format!("unknown enum value {}", v32),
80                        )
81                    })
82            }
83            fn visit_unit<E: ::serde::de::Error>(
84                self,
85            ) -> ::core::result::Result<IndexLayout, E> {
86                ::core::result::Result::Ok(::core::default::Default::default())
87            }
88        }
89        d.deserialize_any(_V)
90    }
91}
92impl ::buffa::json_helpers::ProtoElemJson for IndexLayout {
93    fn serialize_proto_json<S: ::serde::Serializer>(
94        v: &Self,
95        s: S,
96    ) -> ::core::result::Result<S::Ok, S::Error> {
97        ::serde::Serialize::serialize(v, s)
98    }
99    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
100        d: D,
101    ) -> ::core::result::Result<Self, D::Error> {
102        <Self as ::serde::Deserialize>::deserialize(d)
103    }
104}
105impl ::buffa::Enumeration for IndexLayout {
106    fn from_i32(value: i32) -> ::core::option::Option<Self> {
107        match value {
108            0i32 => ::core::option::Option::Some(Self::INDEX_LAYOUT_LEXICOGRAPHIC),
109            1i32 => ::core::option::Option::Some(Self::INDEX_LAYOUT_Z_ORDER),
110            _ => ::core::option::Option::None,
111        }
112    }
113    fn to_i32(&self) -> i32 {
114        *self as i32
115    }
116    fn proto_name(&self) -> &'static str {
117        match self {
118            Self::INDEX_LAYOUT_LEXICOGRAPHIC => "INDEX_LAYOUT_LEXICOGRAPHIC",
119            Self::INDEX_LAYOUT_Z_ORDER => "INDEX_LAYOUT_Z_ORDER",
120        }
121    }
122    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
123        match name {
124            "INDEX_LAYOUT_LEXICOGRAPHIC" => {
125                ::core::option::Option::Some(Self::INDEX_LAYOUT_LEXICOGRAPHIC)
126            }
127            "INDEX_LAYOUT_Z_ORDER" => {
128                ::core::option::Option::Some(Self::INDEX_LAYOUT_Z_ORDER)
129            }
130            _ => ::core::option::Option::None,
131        }
132    }
133}
134/// Stream every batch whose rows match `where_sql`.
135#[derive(Clone, PartialEq, Default)]
136#[derive(::serde::Serialize, ::serde::Deserialize)]
137#[serde(default)]
138pub struct SubscribeRequest {
139    /// Table name registered in the server-side `KvSchema`.
140    ///
141    /// Field 1: `table`
142    #[serde(
143        rename = "table",
144        with = "::buffa::json_helpers::proto_string",
145        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
146    )]
147    pub table: ::buffa::alloc::string::String,
148    /// SQL boolean predicate evaluated against the decoded rows from each
149    /// incoming batch (no `WHERE` keyword). Empty means "emit every decoded
150    /// row". Bounded to keep server-side compile cost predictable.
151    ///
152    /// Field 2: `where_sql`
153    #[serde(
154        rename = "whereSql",
155        alias = "where_sql",
156        with = "::buffa::json_helpers::proto_string",
157        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
158    )]
159    pub where_sql: ::buffa::alloc::string::String,
160    /// Resume cursor over the underlying store batch log. Use
161    /// `SubscribeResponse.sequence_number + 1` to resume after a disconnect.
162    ///
163    /// Field 3: `since_sequence_number`
164    #[serde(
165        rename = "sinceSequenceNumber",
166        alias = "since_sequence_number",
167        with = "::buffa::json_helpers::opt_uint64",
168        skip_serializing_if = "Option::is_none"
169    )]
170    pub since_sequence_number: Option<u64>,
171    #[serde(skip)]
172    #[doc(hidden)]
173    pub __buffa_unknown_fields: ::buffa::UnknownFields,
174    #[doc(hidden)]
175    #[serde(skip)]
176    pub __buffa_cached_size: ::buffa::__private::CachedSize,
177}
178impl ::core::fmt::Debug for SubscribeRequest {
179    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
180        f.debug_struct("SubscribeRequest")
181            .field("table", &self.table)
182            .field("where_sql", &self.where_sql)
183            .field("since_sequence_number", &self.since_sequence_number)
184            .finish()
185    }
186}
187impl SubscribeRequest {
188    /// Protobuf type URL for this message, for use with `Any::pack` and
189    /// `Any::unpack_if`.
190    ///
191    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
192    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.SubscribeRequest";
193}
194unsafe impl ::buffa::DefaultInstance for SubscribeRequest {
195    fn default_instance() -> &'static Self {
196        static VALUE: ::buffa::__private::OnceBox<SubscribeRequest> = ::buffa::__private::OnceBox::new();
197        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
198    }
199}
200impl ::buffa::Message for SubscribeRequest {
201    /// Returns the total encoded size in bytes.
202    ///
203    /// The result is a `u32`; the protobuf specification requires all
204    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
205    /// compliant message will never overflow this type.
206    fn compute_size(&self) -> u32 {
207        #[allow(unused_imports)]
208        use ::buffa::Enumeration as _;
209        let mut size = 0u32;
210        if !self.table.is_empty() {
211            size += 1u32 + ::buffa::types::string_encoded_len(&self.table) as u32;
212        }
213        if !self.where_sql.is_empty() {
214            size += 1u32 + ::buffa::types::string_encoded_len(&self.where_sql) as u32;
215        }
216        if let Some(v) = self.since_sequence_number {
217            size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
218        }
219        size += self.__buffa_unknown_fields.encoded_len() as u32;
220        self.__buffa_cached_size.set(size);
221        size
222    }
223    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
224        #[allow(unused_imports)]
225        use ::buffa::Enumeration as _;
226        if !self.table.is_empty() {
227            ::buffa::encoding::Tag::new(
228                    1u32,
229                    ::buffa::encoding::WireType::LengthDelimited,
230                )
231                .encode(buf);
232            ::buffa::types::encode_string(&self.table, buf);
233        }
234        if !self.where_sql.is_empty() {
235            ::buffa::encoding::Tag::new(
236                    2u32,
237                    ::buffa::encoding::WireType::LengthDelimited,
238                )
239                .encode(buf);
240            ::buffa::types::encode_string(&self.where_sql, buf);
241        }
242        if let Some(v) = self.since_sequence_number {
243            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
244                .encode(buf);
245            ::buffa::types::encode_uint64(v, buf);
246        }
247        self.__buffa_unknown_fields.write_to(buf);
248    }
249    fn merge_field(
250        &mut self,
251        tag: ::buffa::encoding::Tag,
252        buf: &mut impl ::buffa::bytes::Buf,
253        depth: u32,
254    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
255        #[allow(unused_imports)]
256        use ::buffa::bytes::Buf as _;
257        #[allow(unused_imports)]
258        use ::buffa::Enumeration as _;
259        match tag.field_number() {
260            1u32 => {
261                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
262                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
263                        field_number: 1u32,
264                        expected: 2u8,
265                        actual: tag.wire_type() as u8,
266                    });
267                }
268                ::buffa::types::merge_string(&mut self.table, buf)?;
269            }
270            2u32 => {
271                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
272                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
273                        field_number: 2u32,
274                        expected: 2u8,
275                        actual: tag.wire_type() as u8,
276                    });
277                }
278                ::buffa::types::merge_string(&mut self.where_sql, buf)?;
279            }
280            3u32 => {
281                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
282                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
283                        field_number: 3u32,
284                        expected: 0u8,
285                        actual: tag.wire_type() as u8,
286                    });
287                }
288                self.since_sequence_number = ::core::option::Option::Some(
289                    ::buffa::types::decode_uint64(buf)?,
290                );
291            }
292            _ => {
293                self.__buffa_unknown_fields
294                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
295            }
296        }
297        ::core::result::Result::Ok(())
298    }
299    fn cached_size(&self) -> u32 {
300        self.__buffa_cached_size.get()
301    }
302    fn clear(&mut self) {
303        self.table.clear();
304        self.where_sql.clear();
305        self.since_sequence_number = ::core::option::Option::None;
306        self.__buffa_unknown_fields.clear();
307        self.__buffa_cached_size.set(0);
308    }
309}
310impl ::buffa::ExtensionSet for SubscribeRequest {
311    const PROTO_FQN: &'static str = "store.sql.v1.SubscribeRequest";
312    fn unknown_fields(&self) -> &::buffa::UnknownFields {
313        &self.__buffa_unknown_fields
314    }
315    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
316        &mut self.__buffa_unknown_fields
317    }
318}
319impl ::buffa::json_helpers::ProtoElemJson for SubscribeRequest {
320    fn serialize_proto_json<S: ::serde::Serializer>(
321        v: &Self,
322        s: S,
323    ) -> ::core::result::Result<S::Ok, S::Error> {
324        ::serde::Serialize::serialize(v, s)
325    }
326    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
327        d: D,
328    ) -> ::core::result::Result<Self, D::Error> {
329        <Self as ::serde::Deserialize>::deserialize(d)
330    }
331}
332#[doc(hidden)]
333pub const __SUBSCRIBE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
334    type_url: "type.googleapis.com/store.sql.v1.SubscribeRequest",
335    to_json: ::buffa::type_registry::any_to_json::<SubscribeRequest>,
336    from_json: ::buffa::type_registry::any_from_json::<SubscribeRequest>,
337    is_wkt: false,
338};
339/// Stream every batch whose rows match `where_sql`.
340#[derive(Clone, Debug, Default)]
341pub struct SubscribeRequestView<'a> {
342    /// Table name registered in the server-side `KvSchema`.
343    ///
344    /// Field 1: `table`
345    pub table: &'a str,
346    /// SQL boolean predicate evaluated against the decoded rows from each
347    /// incoming batch (no `WHERE` keyword). Empty means "emit every decoded
348    /// row". Bounded to keep server-side compile cost predictable.
349    ///
350    /// Field 2: `where_sql`
351    pub where_sql: &'a str,
352    /// Resume cursor over the underlying store batch log. Use
353    /// `SubscribeResponse.sequence_number + 1` to resume after a disconnect.
354    ///
355    /// Field 3: `since_sequence_number`
356    pub since_sequence_number: ::core::option::Option<u64>,
357    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
358}
359impl<'a> SubscribeRequestView<'a> {
360    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
361    ///
362    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
363    /// and by generated sub-message decode arms with `depth - 1`.
364    ///
365    /// **Not part of the public API.** Named with a leading underscore to
366    /// signal that it is for generated-code use only.
367    #[doc(hidden)]
368    pub fn _decode_depth(
369        buf: &'a [u8],
370        depth: u32,
371    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
372        let mut view = Self::default();
373        view._merge_into_view(buf, depth)?;
374        ::core::result::Result::Ok(view)
375    }
376    /// Merge fields from `buf` into this view (proto merge semantics).
377    ///
378    /// Repeated fields append; singular fields last-wins; singular
379    /// MESSAGE fields merge recursively. Used by sub-message decode
380    /// arms when the same field appears multiple times on the wire.
381    ///
382    /// **Not part of the public API.**
383    #[doc(hidden)]
384    pub fn _merge_into_view(
385        &mut self,
386        buf: &'a [u8],
387        depth: u32,
388    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
389        let _ = depth;
390        #[allow(unused_variables)]
391        let view = self;
392        let mut cur: &'a [u8] = buf;
393        while !cur.is_empty() {
394            let before_tag = cur;
395            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
396            match tag.field_number() {
397                1u32 => {
398                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
399                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
400                            field_number: 1u32,
401                            expected: 2u8,
402                            actual: tag.wire_type() as u8,
403                        });
404                    }
405                    view.table = ::buffa::types::borrow_str(&mut cur)?;
406                }
407                2u32 => {
408                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
409                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
410                            field_number: 2u32,
411                            expected: 2u8,
412                            actual: tag.wire_type() as u8,
413                        });
414                    }
415                    view.where_sql = ::buffa::types::borrow_str(&mut cur)?;
416                }
417                3u32 => {
418                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
419                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
420                            field_number: 3u32,
421                            expected: 0u8,
422                            actual: tag.wire_type() as u8,
423                        });
424                    }
425                    view.since_sequence_number = Some(
426                        ::buffa::types::decode_uint64(&mut cur)?,
427                    );
428                }
429                _ => {
430                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
431                    let span_len = before_tag.len() - cur.len();
432                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
433                }
434            }
435        }
436        ::core::result::Result::Ok(())
437    }
438}
439impl<'a> ::buffa::MessageView<'a> for SubscribeRequestView<'a> {
440    type Owned = SubscribeRequest;
441    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
442        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
443    }
444    fn decode_view_with_limit(
445        buf: &'a [u8],
446        depth: u32,
447    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
448        Self::_decode_depth(buf, depth)
449    }
450    /// Convert this view to the owned message type.
451    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
452    fn to_owned_message(&self) -> SubscribeRequest {
453        #[allow(unused_imports)]
454        use ::buffa::alloc::string::ToString as _;
455        SubscribeRequest {
456            table: self.table.to_string(),
457            where_sql: self.where_sql.to_string(),
458            since_sequence_number: self.since_sequence_number,
459            __buffa_unknown_fields: self
460                .__buffa_unknown_fields
461                .to_owned()
462                .unwrap_or_default()
463                .into(),
464            ..::core::default::Default::default()
465        }
466    }
467}
468unsafe impl ::buffa::DefaultViewInstance for SubscribeRequestView<'static> {
469    fn default_view_instance() -> &'static Self {
470        static VALUE: ::buffa::__private::OnceBox<SubscribeRequestView<'static>> = ::buffa::__private::OnceBox::new();
471        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
472    }
473}
474unsafe impl<'a> ::buffa::HasDefaultViewInstance for SubscribeRequestView<'a> {
475    type Static = SubscribeRequestView<'static>;
476}
477/// Rows from one atomic ingest batch that matched the subscriber's predicate.
478#[derive(Clone, PartialEq, Default)]
479#[derive(::serde::Serialize, ::serde::Deserialize)]
480#[serde(default)]
481pub struct SubscribeResponse {
482    /// Underlying store batch sequence that produced these rows. Always
483    /// monotonically increasing; unique per delivered frame.
484    ///
485    /// Field 1: `sequence_number`
486    #[serde(
487        rename = "sequenceNumber",
488        alias = "sequence_number",
489        with = "::buffa::json_helpers::uint64",
490        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
491    )]
492    pub sequence_number: u64,
493    /// Column names in `rows[].cells` order.
494    ///
495    /// Field 2: `column`
496    #[serde(
497        rename = "column",
498        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
499        deserialize_with = "::buffa::json_helpers::null_as_default"
500    )]
501    pub column: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
502    /// Rows that satisfied `where_sql` from this batch. Empty frames are not
503    /// delivered.
504    ///
505    /// Field 3: `rows`
506    #[serde(
507        rename = "rows",
508        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
509        deserialize_with = "::buffa::json_helpers::null_as_default"
510    )]
511    pub rows: ::buffa::alloc::vec::Vec<Row>,
512    #[serde(skip)]
513    #[doc(hidden)]
514    pub __buffa_unknown_fields: ::buffa::UnknownFields,
515    #[doc(hidden)]
516    #[serde(skip)]
517    pub __buffa_cached_size: ::buffa::__private::CachedSize,
518}
519impl ::core::fmt::Debug for SubscribeResponse {
520    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
521        f.debug_struct("SubscribeResponse")
522            .field("sequence_number", &self.sequence_number)
523            .field("column", &self.column)
524            .field("rows", &self.rows)
525            .finish()
526    }
527}
528impl SubscribeResponse {
529    /// Protobuf type URL for this message, for use with `Any::pack` and
530    /// `Any::unpack_if`.
531    ///
532    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
533    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.SubscribeResponse";
534}
535unsafe impl ::buffa::DefaultInstance for SubscribeResponse {
536    fn default_instance() -> &'static Self {
537        static VALUE: ::buffa::__private::OnceBox<SubscribeResponse> = ::buffa::__private::OnceBox::new();
538        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
539    }
540}
541impl ::buffa::Message for SubscribeResponse {
542    /// Returns the total encoded size in bytes.
543    ///
544    /// The result is a `u32`; the protobuf specification requires all
545    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
546    /// compliant message will never overflow this type.
547    fn compute_size(&self) -> u32 {
548        #[allow(unused_imports)]
549        use ::buffa::Enumeration as _;
550        let mut size = 0u32;
551        if self.sequence_number != 0u64 {
552            size
553                += 1u32
554                    + ::buffa::types::uint64_encoded_len(self.sequence_number) as u32;
555        }
556        for v in &self.column {
557            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
558        }
559        for v in &self.rows {
560            let inner_size = v.compute_size();
561            size
562                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
563                    + inner_size;
564        }
565        size += self.__buffa_unknown_fields.encoded_len() as u32;
566        self.__buffa_cached_size.set(size);
567        size
568    }
569    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
570        #[allow(unused_imports)]
571        use ::buffa::Enumeration as _;
572        if self.sequence_number != 0u64 {
573            ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
574                .encode(buf);
575            ::buffa::types::encode_uint64(self.sequence_number, buf);
576        }
577        for v in &self.column {
578            ::buffa::encoding::Tag::new(
579                    2u32,
580                    ::buffa::encoding::WireType::LengthDelimited,
581                )
582                .encode(buf);
583            ::buffa::types::encode_string(v, buf);
584        }
585        for v in &self.rows {
586            ::buffa::encoding::Tag::new(
587                    3u32,
588                    ::buffa::encoding::WireType::LengthDelimited,
589                )
590                .encode(buf);
591            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
592            v.write_to(buf);
593        }
594        self.__buffa_unknown_fields.write_to(buf);
595    }
596    fn merge_field(
597        &mut self,
598        tag: ::buffa::encoding::Tag,
599        buf: &mut impl ::buffa::bytes::Buf,
600        depth: u32,
601    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
602        #[allow(unused_imports)]
603        use ::buffa::bytes::Buf as _;
604        #[allow(unused_imports)]
605        use ::buffa::Enumeration as _;
606        match tag.field_number() {
607            1u32 => {
608                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
609                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
610                        field_number: 1u32,
611                        expected: 0u8,
612                        actual: tag.wire_type() as u8,
613                    });
614                }
615                self.sequence_number = ::buffa::types::decode_uint64(buf)?;
616            }
617            2u32 => {
618                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
619                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
620                        field_number: 2u32,
621                        expected: 2u8,
622                        actual: tag.wire_type() as u8,
623                    });
624                }
625                self.column.push(::buffa::types::decode_string(buf)?);
626            }
627            3u32 => {
628                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
629                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
630                        field_number: 3u32,
631                        expected: 2u8,
632                        actual: tag.wire_type() as u8,
633                    });
634                }
635                let mut elem = ::core::default::Default::default();
636                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
637                self.rows.push(elem);
638            }
639            _ => {
640                self.__buffa_unknown_fields
641                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
642            }
643        }
644        ::core::result::Result::Ok(())
645    }
646    fn cached_size(&self) -> u32 {
647        self.__buffa_cached_size.get()
648    }
649    fn clear(&mut self) {
650        self.sequence_number = 0u64;
651        self.column.clear();
652        self.rows.clear();
653        self.__buffa_unknown_fields.clear();
654        self.__buffa_cached_size.set(0);
655    }
656}
657impl ::buffa::ExtensionSet for SubscribeResponse {
658    const PROTO_FQN: &'static str = "store.sql.v1.SubscribeResponse";
659    fn unknown_fields(&self) -> &::buffa::UnknownFields {
660        &self.__buffa_unknown_fields
661    }
662    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
663        &mut self.__buffa_unknown_fields
664    }
665}
666impl ::buffa::json_helpers::ProtoElemJson for SubscribeResponse {
667    fn serialize_proto_json<S: ::serde::Serializer>(
668        v: &Self,
669        s: S,
670    ) -> ::core::result::Result<S::Ok, S::Error> {
671        ::serde::Serialize::serialize(v, s)
672    }
673    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
674        d: D,
675    ) -> ::core::result::Result<Self, D::Error> {
676        <Self as ::serde::Deserialize>::deserialize(d)
677    }
678}
679#[doc(hidden)]
680pub const __SUBSCRIBE_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
681    type_url: "type.googleapis.com/store.sql.v1.SubscribeResponse",
682    to_json: ::buffa::type_registry::any_to_json::<SubscribeResponse>,
683    from_json: ::buffa::type_registry::any_from_json::<SubscribeResponse>,
684    is_wkt: false,
685};
686/// Rows from one atomic ingest batch that matched the subscriber's predicate.
687#[derive(Clone, Debug, Default)]
688pub struct SubscribeResponseView<'a> {
689    /// Underlying store batch sequence that produced these rows. Always
690    /// monotonically increasing; unique per delivered frame.
691    ///
692    /// Field 1: `sequence_number`
693    pub sequence_number: u64,
694    /// Column names in `rows[].cells` order.
695    ///
696    /// Field 2: `column`
697    pub column: ::buffa::RepeatedView<'a, &'a str>,
698    /// Rows that satisfied `where_sql` from this batch. Empty frames are not
699    /// delivered.
700    ///
701    /// Field 3: `rows`
702    pub rows: ::buffa::RepeatedView<'a, RowView<'a>>,
703    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
704}
705impl<'a> SubscribeResponseView<'a> {
706    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
707    ///
708    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
709    /// and by generated sub-message decode arms with `depth - 1`.
710    ///
711    /// **Not part of the public API.** Named with a leading underscore to
712    /// signal that it is for generated-code use only.
713    #[doc(hidden)]
714    pub fn _decode_depth(
715        buf: &'a [u8],
716        depth: u32,
717    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
718        let mut view = Self::default();
719        view._merge_into_view(buf, depth)?;
720        ::core::result::Result::Ok(view)
721    }
722    /// Merge fields from `buf` into this view (proto merge semantics).
723    ///
724    /// Repeated fields append; singular fields last-wins; singular
725    /// MESSAGE fields merge recursively. Used by sub-message decode
726    /// arms when the same field appears multiple times on the wire.
727    ///
728    /// **Not part of the public API.**
729    #[doc(hidden)]
730    pub fn _merge_into_view(
731        &mut self,
732        buf: &'a [u8],
733        depth: u32,
734    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
735        let _ = depth;
736        #[allow(unused_variables)]
737        let view = self;
738        let mut cur: &'a [u8] = buf;
739        while !cur.is_empty() {
740            let before_tag = cur;
741            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
742            match tag.field_number() {
743                1u32 => {
744                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
745                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
746                            field_number: 1u32,
747                            expected: 0u8,
748                            actual: tag.wire_type() as u8,
749                        });
750                    }
751                    view.sequence_number = ::buffa::types::decode_uint64(&mut cur)?;
752                }
753                2u32 => {
754                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
755                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
756                            field_number: 2u32,
757                            expected: 2u8,
758                            actual: tag.wire_type() as u8,
759                        });
760                    }
761                    view.column.push(::buffa::types::borrow_str(&mut cur)?);
762                }
763                3u32 => {
764                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
765                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
766                            field_number: 3u32,
767                            expected: 2u8,
768                            actual: tag.wire_type() as u8,
769                        });
770                    }
771                    if depth == 0 {
772                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
773                    }
774                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
775                    view.rows.push(RowView::_decode_depth(sub, depth - 1)?);
776                }
777                _ => {
778                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
779                    let span_len = before_tag.len() - cur.len();
780                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
781                }
782            }
783        }
784        ::core::result::Result::Ok(())
785    }
786}
787impl<'a> ::buffa::MessageView<'a> for SubscribeResponseView<'a> {
788    type Owned = SubscribeResponse;
789    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
790        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
791    }
792    fn decode_view_with_limit(
793        buf: &'a [u8],
794        depth: u32,
795    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
796        Self::_decode_depth(buf, depth)
797    }
798    /// Convert this view to the owned message type.
799    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
800    fn to_owned_message(&self) -> SubscribeResponse {
801        #[allow(unused_imports)]
802        use ::buffa::alloc::string::ToString as _;
803        SubscribeResponse {
804            sequence_number: self.sequence_number,
805            column: self.column.iter().map(|s| s.to_string()).collect(),
806            rows: self.rows.iter().map(|v| v.to_owned_message()).collect(),
807            __buffa_unknown_fields: self
808                .__buffa_unknown_fields
809                .to_owned()
810                .unwrap_or_default()
811                .into(),
812            ..::core::default::Default::default()
813        }
814    }
815}
816unsafe impl ::buffa::DefaultViewInstance for SubscribeResponseView<'static> {
817    fn default_view_instance() -> &'static Self {
818        static VALUE: ::buffa::__private::OnceBox<SubscribeResponseView<'static>> = ::buffa::__private::OnceBox::new();
819        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
820    }
821}
822unsafe impl<'a> ::buffa::HasDefaultViewInstance for SubscribeResponseView<'a> {
823    type Static = SubscribeResponseView<'static>;
824}
825/// Discovery request; currently has no parameters.
826#[derive(Clone, PartialEq, Default)]
827#[derive(::serde::Serialize, ::serde::Deserialize)]
828#[serde(default)]
829pub struct TablesRequest {
830    #[serde(skip)]
831    #[doc(hidden)]
832    pub __buffa_unknown_fields: ::buffa::UnknownFields,
833    #[doc(hidden)]
834    #[serde(skip)]
835    pub __buffa_cached_size: ::buffa::__private::CachedSize,
836}
837impl ::core::fmt::Debug for TablesRequest {
838    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
839        f.debug_struct("TablesRequest").finish()
840    }
841}
842impl TablesRequest {
843    /// Protobuf type URL for this message, for use with `Any::pack` and
844    /// `Any::unpack_if`.
845    ///
846    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
847    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.TablesRequest";
848}
849unsafe impl ::buffa::DefaultInstance for TablesRequest {
850    fn default_instance() -> &'static Self {
851        static VALUE: ::buffa::__private::OnceBox<TablesRequest> = ::buffa::__private::OnceBox::new();
852        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
853    }
854}
855impl ::buffa::Message for TablesRequest {
856    /// Returns the total encoded size in bytes.
857    ///
858    /// The result is a `u32`; the protobuf specification requires all
859    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
860    /// compliant message will never overflow this type.
861    fn compute_size(&self) -> u32 {
862        #[allow(unused_imports)]
863        use ::buffa::Enumeration as _;
864        let mut size = 0u32;
865        size += self.__buffa_unknown_fields.encoded_len() as u32;
866        self.__buffa_cached_size.set(size);
867        size
868    }
869    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
870        #[allow(unused_imports)]
871        use ::buffa::Enumeration as _;
872        self.__buffa_unknown_fields.write_to(buf);
873    }
874    fn merge_field(
875        &mut self,
876        tag: ::buffa::encoding::Tag,
877        buf: &mut impl ::buffa::bytes::Buf,
878        depth: u32,
879    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
880        #[allow(unused_imports)]
881        use ::buffa::bytes::Buf as _;
882        #[allow(unused_imports)]
883        use ::buffa::Enumeration as _;
884        match tag.field_number() {
885            _ => {
886                self.__buffa_unknown_fields
887                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
888            }
889        }
890        ::core::result::Result::Ok(())
891    }
892    fn cached_size(&self) -> u32 {
893        self.__buffa_cached_size.get()
894    }
895    fn clear(&mut self) {
896        self.__buffa_unknown_fields.clear();
897        self.__buffa_cached_size.set(0);
898    }
899}
900impl ::buffa::ExtensionSet for TablesRequest {
901    const PROTO_FQN: &'static str = "store.sql.v1.TablesRequest";
902    fn unknown_fields(&self) -> &::buffa::UnknownFields {
903        &self.__buffa_unknown_fields
904    }
905    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
906        &mut self.__buffa_unknown_fields
907    }
908}
909impl ::buffa::json_helpers::ProtoElemJson for TablesRequest {
910    fn serialize_proto_json<S: ::serde::Serializer>(
911        v: &Self,
912        s: S,
913    ) -> ::core::result::Result<S::Ok, S::Error> {
914        ::serde::Serialize::serialize(v, s)
915    }
916    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
917        d: D,
918    ) -> ::core::result::Result<Self, D::Error> {
919        <Self as ::serde::Deserialize>::deserialize(d)
920    }
921}
922#[doc(hidden)]
923pub const __TABLES_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
924    type_url: "type.googleapis.com/store.sql.v1.TablesRequest",
925    to_json: ::buffa::type_registry::any_to_json::<TablesRequest>,
926    from_json: ::buffa::type_registry::any_from_json::<TablesRequest>,
927    is_wkt: false,
928};
929/// Discovery request; currently has no parameters.
930#[derive(Clone, Debug, Default)]
931pub struct TablesRequestView<'a> {
932    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
933}
934impl<'a> TablesRequestView<'a> {
935    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
936    ///
937    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
938    /// and by generated sub-message decode arms with `depth - 1`.
939    ///
940    /// **Not part of the public API.** Named with a leading underscore to
941    /// signal that it is for generated-code use only.
942    #[doc(hidden)]
943    pub fn _decode_depth(
944        buf: &'a [u8],
945        depth: u32,
946    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
947        let mut view = Self::default();
948        view._merge_into_view(buf, depth)?;
949        ::core::result::Result::Ok(view)
950    }
951    /// Merge fields from `buf` into this view (proto merge semantics).
952    ///
953    /// Repeated fields append; singular fields last-wins; singular
954    /// MESSAGE fields merge recursively. Used by sub-message decode
955    /// arms when the same field appears multiple times on the wire.
956    ///
957    /// **Not part of the public API.**
958    #[doc(hidden)]
959    pub fn _merge_into_view(
960        &mut self,
961        buf: &'a [u8],
962        depth: u32,
963    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
964        let _ = depth;
965        #[allow(unused_variables)]
966        let view = self;
967        let mut cur: &'a [u8] = buf;
968        while !cur.is_empty() {
969            let before_tag = cur;
970            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
971            match tag.field_number() {
972                _ => {
973                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
974                    let span_len = before_tag.len() - cur.len();
975                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
976                }
977            }
978        }
979        ::core::result::Result::Ok(())
980    }
981}
982impl<'a> ::buffa::MessageView<'a> for TablesRequestView<'a> {
983    type Owned = TablesRequest;
984    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
985        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
986    }
987    fn decode_view_with_limit(
988        buf: &'a [u8],
989        depth: u32,
990    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
991        Self::_decode_depth(buf, depth)
992    }
993    /// Convert this view to the owned message type.
994    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
995    fn to_owned_message(&self) -> TablesRequest {
996        #[allow(unused_imports)]
997        use ::buffa::alloc::string::ToString as _;
998        TablesRequest {
999            __buffa_unknown_fields: self
1000                .__buffa_unknown_fields
1001                .to_owned()
1002                .unwrap_or_default()
1003                .into(),
1004            ..::core::default::Default::default()
1005        }
1006    }
1007}
1008unsafe impl ::buffa::DefaultViewInstance for TablesRequestView<'static> {
1009    fn default_view_instance() -> &'static Self {
1010        static VALUE: ::buffa::__private::OnceBox<TablesRequestView<'static>> = ::buffa::__private::OnceBox::new();
1011        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1012    }
1013}
1014unsafe impl<'a> ::buffa::HasDefaultViewInstance for TablesRequestView<'a> {
1015    type Static = TablesRequestView<'static>;
1016}
1017/// Describes every table registered in the server-side `KvSchema`.
1018#[derive(Clone, PartialEq, Default)]
1019#[derive(::serde::Serialize, ::serde::Deserialize)]
1020#[serde(default)]
1021pub struct TablesResponse {
1022    /// Field 1: `tables`
1023    #[serde(
1024        rename = "tables",
1025        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1026        deserialize_with = "::buffa::json_helpers::null_as_default"
1027    )]
1028    pub tables: ::buffa::alloc::vec::Vec<Table>,
1029    #[serde(skip)]
1030    #[doc(hidden)]
1031    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1032    #[doc(hidden)]
1033    #[serde(skip)]
1034    pub __buffa_cached_size: ::buffa::__private::CachedSize,
1035}
1036impl ::core::fmt::Debug for TablesResponse {
1037    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1038        f.debug_struct("TablesResponse").field("tables", &self.tables).finish()
1039    }
1040}
1041impl TablesResponse {
1042    /// Protobuf type URL for this message, for use with `Any::pack` and
1043    /// `Any::unpack_if`.
1044    ///
1045    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1046    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.TablesResponse";
1047}
1048unsafe impl ::buffa::DefaultInstance for TablesResponse {
1049    fn default_instance() -> &'static Self {
1050        static VALUE: ::buffa::__private::OnceBox<TablesResponse> = ::buffa::__private::OnceBox::new();
1051        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1052    }
1053}
1054impl ::buffa::Message for TablesResponse {
1055    /// Returns the total encoded size in bytes.
1056    ///
1057    /// The result is a `u32`; the protobuf specification requires all
1058    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1059    /// compliant message will never overflow this type.
1060    fn compute_size(&self) -> u32 {
1061        #[allow(unused_imports)]
1062        use ::buffa::Enumeration as _;
1063        let mut size = 0u32;
1064        for v in &self.tables {
1065            let inner_size = v.compute_size();
1066            size
1067                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1068                    + inner_size;
1069        }
1070        size += self.__buffa_unknown_fields.encoded_len() as u32;
1071        self.__buffa_cached_size.set(size);
1072        size
1073    }
1074    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
1075        #[allow(unused_imports)]
1076        use ::buffa::Enumeration as _;
1077        for v in &self.tables {
1078            ::buffa::encoding::Tag::new(
1079                    1u32,
1080                    ::buffa::encoding::WireType::LengthDelimited,
1081                )
1082                .encode(buf);
1083            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
1084            v.write_to(buf);
1085        }
1086        self.__buffa_unknown_fields.write_to(buf);
1087    }
1088    fn merge_field(
1089        &mut self,
1090        tag: ::buffa::encoding::Tag,
1091        buf: &mut impl ::buffa::bytes::Buf,
1092        depth: u32,
1093    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1094        #[allow(unused_imports)]
1095        use ::buffa::bytes::Buf as _;
1096        #[allow(unused_imports)]
1097        use ::buffa::Enumeration as _;
1098        match tag.field_number() {
1099            1u32 => {
1100                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1101                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1102                        field_number: 1u32,
1103                        expected: 2u8,
1104                        actual: tag.wire_type() as u8,
1105                    });
1106                }
1107                let mut elem = ::core::default::Default::default();
1108                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1109                self.tables.push(elem);
1110            }
1111            _ => {
1112                self.__buffa_unknown_fields
1113                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1114            }
1115        }
1116        ::core::result::Result::Ok(())
1117    }
1118    fn cached_size(&self) -> u32 {
1119        self.__buffa_cached_size.get()
1120    }
1121    fn clear(&mut self) {
1122        self.tables.clear();
1123        self.__buffa_unknown_fields.clear();
1124        self.__buffa_cached_size.set(0);
1125    }
1126}
1127impl ::buffa::ExtensionSet for TablesResponse {
1128    const PROTO_FQN: &'static str = "store.sql.v1.TablesResponse";
1129    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1130        &self.__buffa_unknown_fields
1131    }
1132    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1133        &mut self.__buffa_unknown_fields
1134    }
1135}
1136impl ::buffa::json_helpers::ProtoElemJson for TablesResponse {
1137    fn serialize_proto_json<S: ::serde::Serializer>(
1138        v: &Self,
1139        s: S,
1140    ) -> ::core::result::Result<S::Ok, S::Error> {
1141        ::serde::Serialize::serialize(v, s)
1142    }
1143    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1144        d: D,
1145    ) -> ::core::result::Result<Self, D::Error> {
1146        <Self as ::serde::Deserialize>::deserialize(d)
1147    }
1148}
1149#[doc(hidden)]
1150pub const __TABLES_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1151    type_url: "type.googleapis.com/store.sql.v1.TablesResponse",
1152    to_json: ::buffa::type_registry::any_to_json::<TablesResponse>,
1153    from_json: ::buffa::type_registry::any_from_json::<TablesResponse>,
1154    is_wkt: false,
1155};
1156/// Describes every table registered in the server-side `KvSchema`.
1157#[derive(Clone, Debug, Default)]
1158pub struct TablesResponseView<'a> {
1159    /// Field 1: `tables`
1160    pub tables: ::buffa::RepeatedView<'a, TableView<'a>>,
1161    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1162}
1163impl<'a> TablesResponseView<'a> {
1164    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
1165    ///
1166    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
1167    /// and by generated sub-message decode arms with `depth - 1`.
1168    ///
1169    /// **Not part of the public API.** Named with a leading underscore to
1170    /// signal that it is for generated-code use only.
1171    #[doc(hidden)]
1172    pub fn _decode_depth(
1173        buf: &'a [u8],
1174        depth: u32,
1175    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1176        let mut view = Self::default();
1177        view._merge_into_view(buf, depth)?;
1178        ::core::result::Result::Ok(view)
1179    }
1180    /// Merge fields from `buf` into this view (proto merge semantics).
1181    ///
1182    /// Repeated fields append; singular fields last-wins; singular
1183    /// MESSAGE fields merge recursively. Used by sub-message decode
1184    /// arms when the same field appears multiple times on the wire.
1185    ///
1186    /// **Not part of the public API.**
1187    #[doc(hidden)]
1188    pub fn _merge_into_view(
1189        &mut self,
1190        buf: &'a [u8],
1191        depth: u32,
1192    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1193        let _ = depth;
1194        #[allow(unused_variables)]
1195        let view = self;
1196        let mut cur: &'a [u8] = buf;
1197        while !cur.is_empty() {
1198            let before_tag = cur;
1199            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1200            match tag.field_number() {
1201                1u32 => {
1202                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1203                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1204                            field_number: 1u32,
1205                            expected: 2u8,
1206                            actual: tag.wire_type() as u8,
1207                        });
1208                    }
1209                    if depth == 0 {
1210                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
1211                    }
1212                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1213                    view.tables.push(TableView::_decode_depth(sub, depth - 1)?);
1214                }
1215                _ => {
1216                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1217                    let span_len = before_tag.len() - cur.len();
1218                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1219                }
1220            }
1221        }
1222        ::core::result::Result::Ok(())
1223    }
1224}
1225impl<'a> ::buffa::MessageView<'a> for TablesResponseView<'a> {
1226    type Owned = TablesResponse;
1227    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1228        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1229    }
1230    fn decode_view_with_limit(
1231        buf: &'a [u8],
1232        depth: u32,
1233    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1234        Self::_decode_depth(buf, depth)
1235    }
1236    /// Convert this view to the owned message type.
1237    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
1238    fn to_owned_message(&self) -> TablesResponse {
1239        #[allow(unused_imports)]
1240        use ::buffa::alloc::string::ToString as _;
1241        TablesResponse {
1242            tables: self.tables.iter().map(|v| v.to_owned_message()).collect(),
1243            __buffa_unknown_fields: self
1244                .__buffa_unknown_fields
1245                .to_owned()
1246                .unwrap_or_default()
1247                .into(),
1248            ..::core::default::Default::default()
1249        }
1250    }
1251}
1252unsafe impl ::buffa::DefaultViewInstance for TablesResponseView<'static> {
1253    fn default_view_instance() -> &'static Self {
1254        static VALUE: ::buffa::__private::OnceBox<TablesResponseView<'static>> = ::buffa::__private::OnceBox::new();
1255        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1256    }
1257}
1258unsafe impl<'a> ::buffa::HasDefaultViewInstance for TablesResponseView<'a> {
1259    type Static = TablesResponseView<'static>;
1260}
1261/// Server-registered table.
1262#[derive(Clone, PartialEq, Default)]
1263#[derive(::serde::Serialize, ::serde::Deserialize)]
1264#[serde(default)]
1265pub struct Table {
1266    /// Name clients pass to `Subscribe.table` / reference in `Query.sql`.
1267    ///
1268    /// Field 1: `name`
1269    #[serde(
1270        rename = "name",
1271        with = "::buffa::json_helpers::proto_string",
1272        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1273    )]
1274    pub name: ::buffa::alloc::string::String,
1275    /// Columns in declaration order. `Subscribe` emits rows in this order.
1276    ///
1277    /// Field 2: `columns`
1278    #[serde(
1279        rename = "columns",
1280        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1281        deserialize_with = "::buffa::json_helpers::null_as_default"
1282    )]
1283    pub columns: ::buffa::alloc::vec::Vec<Column>,
1284    /// Indices into `columns` that form the primary key, in key-sort order.
1285    ///
1286    /// Field 3: `primary_key_columns`
1287    #[serde(
1288        rename = "primaryKeyColumns",
1289        alias = "primary_key_columns",
1290        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1291        deserialize_with = "::buffa::json_helpers::null_as_default"
1292    )]
1293    pub primary_key_columns: ::buffa::alloc::vec::Vec<u32>,
1294    /// Secondary indexes declared on this table, in registration order.
1295    ///
1296    /// Field 4: `indexes`
1297    #[serde(
1298        rename = "indexes",
1299        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1300        deserialize_with = "::buffa::json_helpers::null_as_default"
1301    )]
1302    pub indexes: ::buffa::alloc::vec::Vec<Index>,
1303    #[serde(skip)]
1304    #[doc(hidden)]
1305    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1306    #[doc(hidden)]
1307    #[serde(skip)]
1308    pub __buffa_cached_size: ::buffa::__private::CachedSize,
1309}
1310impl ::core::fmt::Debug for Table {
1311    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1312        f.debug_struct("Table")
1313            .field("name", &self.name)
1314            .field("columns", &self.columns)
1315            .field("primary_key_columns", &self.primary_key_columns)
1316            .field("indexes", &self.indexes)
1317            .finish()
1318    }
1319}
1320impl Table {
1321    /// Protobuf type URL for this message, for use with `Any::pack` and
1322    /// `Any::unpack_if`.
1323    ///
1324    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1325    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Table";
1326}
1327unsafe impl ::buffa::DefaultInstance for Table {
1328    fn default_instance() -> &'static Self {
1329        static VALUE: ::buffa::__private::OnceBox<Table> = ::buffa::__private::OnceBox::new();
1330        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1331    }
1332}
1333impl ::buffa::Message for Table {
1334    /// Returns the total encoded size in bytes.
1335    ///
1336    /// The result is a `u32`; the protobuf specification requires all
1337    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1338    /// compliant message will never overflow this type.
1339    fn compute_size(&self) -> u32 {
1340        #[allow(unused_imports)]
1341        use ::buffa::Enumeration as _;
1342        let mut size = 0u32;
1343        if !self.name.is_empty() {
1344            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
1345        }
1346        for v in &self.columns {
1347            let inner_size = v.compute_size();
1348            size
1349                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1350                    + inner_size;
1351        }
1352        if !self.primary_key_columns.is_empty() {
1353            let payload: u32 = self
1354                .primary_key_columns
1355                .iter()
1356                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
1357                .sum::<u32>();
1358            size
1359                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
1360        }
1361        for v in &self.indexes {
1362            let inner_size = v.compute_size();
1363            size
1364                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1365                    + inner_size;
1366        }
1367        size += self.__buffa_unknown_fields.encoded_len() as u32;
1368        self.__buffa_cached_size.set(size);
1369        size
1370    }
1371    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
1372        #[allow(unused_imports)]
1373        use ::buffa::Enumeration as _;
1374        if !self.name.is_empty() {
1375            ::buffa::encoding::Tag::new(
1376                    1u32,
1377                    ::buffa::encoding::WireType::LengthDelimited,
1378                )
1379                .encode(buf);
1380            ::buffa::types::encode_string(&self.name, buf);
1381        }
1382        for v in &self.columns {
1383            ::buffa::encoding::Tag::new(
1384                    2u32,
1385                    ::buffa::encoding::WireType::LengthDelimited,
1386                )
1387                .encode(buf);
1388            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
1389            v.write_to(buf);
1390        }
1391        if !self.primary_key_columns.is_empty() {
1392            let payload: u32 = self
1393                .primary_key_columns
1394                .iter()
1395                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
1396                .sum::<u32>();
1397            ::buffa::encoding::Tag::new(
1398                    3u32,
1399                    ::buffa::encoding::WireType::LengthDelimited,
1400                )
1401                .encode(buf);
1402            ::buffa::encoding::encode_varint(payload as u64, buf);
1403            for &v in &self.primary_key_columns {
1404                ::buffa::types::encode_uint32(v, buf);
1405            }
1406        }
1407        for v in &self.indexes {
1408            ::buffa::encoding::Tag::new(
1409                    4u32,
1410                    ::buffa::encoding::WireType::LengthDelimited,
1411                )
1412                .encode(buf);
1413            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
1414            v.write_to(buf);
1415        }
1416        self.__buffa_unknown_fields.write_to(buf);
1417    }
1418    fn merge_field(
1419        &mut self,
1420        tag: ::buffa::encoding::Tag,
1421        buf: &mut impl ::buffa::bytes::Buf,
1422        depth: u32,
1423    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1424        #[allow(unused_imports)]
1425        use ::buffa::bytes::Buf as _;
1426        #[allow(unused_imports)]
1427        use ::buffa::Enumeration as _;
1428        match tag.field_number() {
1429            1u32 => {
1430                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1431                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1432                        field_number: 1u32,
1433                        expected: 2u8,
1434                        actual: tag.wire_type() as u8,
1435                    });
1436                }
1437                ::buffa::types::merge_string(&mut self.name, buf)?;
1438            }
1439            2u32 => {
1440                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1441                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1442                        field_number: 2u32,
1443                        expected: 2u8,
1444                        actual: tag.wire_type() as u8,
1445                    });
1446                }
1447                let mut elem = ::core::default::Default::default();
1448                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1449                self.columns.push(elem);
1450            }
1451            3u32 => {
1452                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1453                    let len = ::buffa::encoding::decode_varint(buf)?;
1454                    let len = usize::try_from(len)
1455                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1456                    if buf.remaining() < len {
1457                        return ::core::result::Result::Err(
1458                            ::buffa::DecodeError::UnexpectedEof,
1459                        );
1460                    }
1461                    self.primary_key_columns.reserve(len);
1462                    let mut limited = buf.take(len);
1463                    while limited.has_remaining() {
1464                        self.primary_key_columns
1465                            .push(::buffa::types::decode_uint32(&mut limited)?);
1466                    }
1467                    let leftover = limited.remaining();
1468                    if leftover > 0 {
1469                        limited.advance(leftover);
1470                    }
1471                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1472                    self.primary_key_columns.push(::buffa::types::decode_uint32(buf)?);
1473                } else {
1474                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1475                        field_number: 3u32,
1476                        expected: 2u8,
1477                        actual: tag.wire_type() as u8,
1478                    });
1479                }
1480            }
1481            4u32 => {
1482                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1483                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1484                        field_number: 4u32,
1485                        expected: 2u8,
1486                        actual: tag.wire_type() as u8,
1487                    });
1488                }
1489                let mut elem = ::core::default::Default::default();
1490                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1491                self.indexes.push(elem);
1492            }
1493            _ => {
1494                self.__buffa_unknown_fields
1495                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1496            }
1497        }
1498        ::core::result::Result::Ok(())
1499    }
1500    fn cached_size(&self) -> u32 {
1501        self.__buffa_cached_size.get()
1502    }
1503    fn clear(&mut self) {
1504        self.name.clear();
1505        self.columns.clear();
1506        self.primary_key_columns.clear();
1507        self.indexes.clear();
1508        self.__buffa_unknown_fields.clear();
1509        self.__buffa_cached_size.set(0);
1510    }
1511}
1512impl ::buffa::ExtensionSet for Table {
1513    const PROTO_FQN: &'static str = "store.sql.v1.Table";
1514    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1515        &self.__buffa_unknown_fields
1516    }
1517    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1518        &mut self.__buffa_unknown_fields
1519    }
1520}
1521impl ::buffa::json_helpers::ProtoElemJson for Table {
1522    fn serialize_proto_json<S: ::serde::Serializer>(
1523        v: &Self,
1524        s: S,
1525    ) -> ::core::result::Result<S::Ok, S::Error> {
1526        ::serde::Serialize::serialize(v, s)
1527    }
1528    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1529        d: D,
1530    ) -> ::core::result::Result<Self, D::Error> {
1531        <Self as ::serde::Deserialize>::deserialize(d)
1532    }
1533}
1534#[doc(hidden)]
1535pub const __TABLE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1536    type_url: "type.googleapis.com/store.sql.v1.Table",
1537    to_json: ::buffa::type_registry::any_to_json::<Table>,
1538    from_json: ::buffa::type_registry::any_from_json::<Table>,
1539    is_wkt: false,
1540};
1541/// Server-registered table.
1542#[derive(Clone, Debug, Default)]
1543pub struct TableView<'a> {
1544    /// Name clients pass to `Subscribe.table` / reference in `Query.sql`.
1545    ///
1546    /// Field 1: `name`
1547    pub name: &'a str,
1548    /// Columns in declaration order. `Subscribe` emits rows in this order.
1549    ///
1550    /// Field 2: `columns`
1551    pub columns: ::buffa::RepeatedView<'a, ColumnView<'a>>,
1552    /// Indices into `columns` that form the primary key, in key-sort order.
1553    ///
1554    /// Field 3: `primary_key_columns`
1555    pub primary_key_columns: ::buffa::RepeatedView<'a, u32>,
1556    /// Secondary indexes declared on this table, in registration order.
1557    ///
1558    /// Field 4: `indexes`
1559    pub indexes: ::buffa::RepeatedView<'a, IndexView<'a>>,
1560    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1561}
1562impl<'a> TableView<'a> {
1563    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
1564    ///
1565    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
1566    /// and by generated sub-message decode arms with `depth - 1`.
1567    ///
1568    /// **Not part of the public API.** Named with a leading underscore to
1569    /// signal that it is for generated-code use only.
1570    #[doc(hidden)]
1571    pub fn _decode_depth(
1572        buf: &'a [u8],
1573        depth: u32,
1574    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1575        let mut view = Self::default();
1576        view._merge_into_view(buf, depth)?;
1577        ::core::result::Result::Ok(view)
1578    }
1579    /// Merge fields from `buf` into this view (proto merge semantics).
1580    ///
1581    /// Repeated fields append; singular fields last-wins; singular
1582    /// MESSAGE fields merge recursively. Used by sub-message decode
1583    /// arms when the same field appears multiple times on the wire.
1584    ///
1585    /// **Not part of the public API.**
1586    #[doc(hidden)]
1587    pub fn _merge_into_view(
1588        &mut self,
1589        buf: &'a [u8],
1590        depth: u32,
1591    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1592        let _ = depth;
1593        #[allow(unused_variables)]
1594        let view = self;
1595        let mut cur: &'a [u8] = buf;
1596        while !cur.is_empty() {
1597            let before_tag = cur;
1598            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1599            match tag.field_number() {
1600                1u32 => {
1601                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1602                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1603                            field_number: 1u32,
1604                            expected: 2u8,
1605                            actual: tag.wire_type() as u8,
1606                        });
1607                    }
1608                    view.name = ::buffa::types::borrow_str(&mut cur)?;
1609                }
1610                2u32 => {
1611                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1612                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1613                            field_number: 2u32,
1614                            expected: 2u8,
1615                            actual: tag.wire_type() as u8,
1616                        });
1617                    }
1618                    if depth == 0 {
1619                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
1620                    }
1621                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1622                    view.columns.push(ColumnView::_decode_depth(sub, depth - 1)?);
1623                }
1624                3u32 => {
1625                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1626                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
1627                        let mut pcur: &[u8] = payload;
1628                        while !pcur.is_empty() {
1629                            view.primary_key_columns
1630                                .push(::buffa::types::decode_uint32(&mut pcur)?);
1631                        }
1632                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1633                        view.primary_key_columns
1634                            .push(::buffa::types::decode_uint32(&mut cur)?);
1635                    } else {
1636                        return Err(::buffa::DecodeError::WireTypeMismatch {
1637                            field_number: 3u32,
1638                            expected: 2u8,
1639                            actual: tag.wire_type() as u8,
1640                        });
1641                    }
1642                }
1643                4u32 => {
1644                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1645                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1646                            field_number: 4u32,
1647                            expected: 2u8,
1648                            actual: tag.wire_type() as u8,
1649                        });
1650                    }
1651                    if depth == 0 {
1652                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
1653                    }
1654                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1655                    view.indexes.push(IndexView::_decode_depth(sub, depth - 1)?);
1656                }
1657                _ => {
1658                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1659                    let span_len = before_tag.len() - cur.len();
1660                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1661                }
1662            }
1663        }
1664        ::core::result::Result::Ok(())
1665    }
1666}
1667impl<'a> ::buffa::MessageView<'a> for TableView<'a> {
1668    type Owned = Table;
1669    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1670        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1671    }
1672    fn decode_view_with_limit(
1673        buf: &'a [u8],
1674        depth: u32,
1675    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1676        Self::_decode_depth(buf, depth)
1677    }
1678    /// Convert this view to the owned message type.
1679    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
1680    fn to_owned_message(&self) -> Table {
1681        #[allow(unused_imports)]
1682        use ::buffa::alloc::string::ToString as _;
1683        Table {
1684            name: self.name.to_string(),
1685            columns: self.columns.iter().map(|v| v.to_owned_message()).collect(),
1686            primary_key_columns: self.primary_key_columns.to_vec(),
1687            indexes: self.indexes.iter().map(|v| v.to_owned_message()).collect(),
1688            __buffa_unknown_fields: self
1689                .__buffa_unknown_fields
1690                .to_owned()
1691                .unwrap_or_default()
1692                .into(),
1693            ..::core::default::Default::default()
1694        }
1695    }
1696}
1697unsafe impl ::buffa::DefaultViewInstance for TableView<'static> {
1698    fn default_view_instance() -> &'static Self {
1699        static VALUE: ::buffa::__private::OnceBox<TableView<'static>> = ::buffa::__private::OnceBox::new();
1700        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1701    }
1702}
1703unsafe impl<'a> ::buffa::HasDefaultViewInstance for TableView<'a> {
1704    type Static = TableView<'static>;
1705}
1706/// One column of a registered `Table`.
1707#[derive(Clone, PartialEq, Default)]
1708#[derive(::serde::Serialize, ::serde::Deserialize)]
1709#[serde(default)]
1710pub struct Column {
1711    /// Field 1: `name`
1712    #[serde(
1713        rename = "name",
1714        with = "::buffa::json_helpers::proto_string",
1715        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1716    )]
1717    pub name: ::buffa::alloc::string::String,
1718    /// Arrow DataType rendered as its stable debug string (e.g. `Int64`,
1719    /// `Utf8`, `Timestamp(Microsecond, None)`, `Decimal128(38, 10)`). Clients
1720    /// that need typed handling should match against these exact strings.
1721    ///
1722    /// Field 2: `data_type`
1723    #[serde(
1724        rename = "dataType",
1725        alias = "data_type",
1726        with = "::buffa::json_helpers::proto_string",
1727        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1728    )]
1729    pub data_type: ::buffa::alloc::string::String,
1730    /// Field 3: `nullable`
1731    #[serde(
1732        rename = "nullable",
1733        with = "::buffa::json_helpers::proto_bool",
1734        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
1735    )]
1736    pub nullable: bool,
1737    #[serde(skip)]
1738    #[doc(hidden)]
1739    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1740    #[doc(hidden)]
1741    #[serde(skip)]
1742    pub __buffa_cached_size: ::buffa::__private::CachedSize,
1743}
1744impl ::core::fmt::Debug for Column {
1745    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1746        f.debug_struct("Column")
1747            .field("name", &self.name)
1748            .field("data_type", &self.data_type)
1749            .field("nullable", &self.nullable)
1750            .finish()
1751    }
1752}
1753impl Column {
1754    /// Protobuf type URL for this message, for use with `Any::pack` and
1755    /// `Any::unpack_if`.
1756    ///
1757    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1758    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Column";
1759}
1760unsafe impl ::buffa::DefaultInstance for Column {
1761    fn default_instance() -> &'static Self {
1762        static VALUE: ::buffa::__private::OnceBox<Column> = ::buffa::__private::OnceBox::new();
1763        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1764    }
1765}
1766impl ::buffa::Message for Column {
1767    /// Returns the total encoded size in bytes.
1768    ///
1769    /// The result is a `u32`; the protobuf specification requires all
1770    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1771    /// compliant message will never overflow this type.
1772    fn compute_size(&self) -> u32 {
1773        #[allow(unused_imports)]
1774        use ::buffa::Enumeration as _;
1775        let mut size = 0u32;
1776        if !self.name.is_empty() {
1777            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
1778        }
1779        if !self.data_type.is_empty() {
1780            size += 1u32 + ::buffa::types::string_encoded_len(&self.data_type) as u32;
1781        }
1782        if self.nullable {
1783            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
1784        }
1785        size += self.__buffa_unknown_fields.encoded_len() as u32;
1786        self.__buffa_cached_size.set(size);
1787        size
1788    }
1789    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
1790        #[allow(unused_imports)]
1791        use ::buffa::Enumeration as _;
1792        if !self.name.is_empty() {
1793            ::buffa::encoding::Tag::new(
1794                    1u32,
1795                    ::buffa::encoding::WireType::LengthDelimited,
1796                )
1797                .encode(buf);
1798            ::buffa::types::encode_string(&self.name, buf);
1799        }
1800        if !self.data_type.is_empty() {
1801            ::buffa::encoding::Tag::new(
1802                    2u32,
1803                    ::buffa::encoding::WireType::LengthDelimited,
1804                )
1805                .encode(buf);
1806            ::buffa::types::encode_string(&self.data_type, buf);
1807        }
1808        if self.nullable {
1809            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
1810                .encode(buf);
1811            ::buffa::types::encode_bool(self.nullable, buf);
1812        }
1813        self.__buffa_unknown_fields.write_to(buf);
1814    }
1815    fn merge_field(
1816        &mut self,
1817        tag: ::buffa::encoding::Tag,
1818        buf: &mut impl ::buffa::bytes::Buf,
1819        depth: u32,
1820    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1821        #[allow(unused_imports)]
1822        use ::buffa::bytes::Buf as _;
1823        #[allow(unused_imports)]
1824        use ::buffa::Enumeration as _;
1825        match tag.field_number() {
1826            1u32 => {
1827                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1828                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1829                        field_number: 1u32,
1830                        expected: 2u8,
1831                        actual: tag.wire_type() as u8,
1832                    });
1833                }
1834                ::buffa::types::merge_string(&mut self.name, buf)?;
1835            }
1836            2u32 => {
1837                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1838                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1839                        field_number: 2u32,
1840                        expected: 2u8,
1841                        actual: tag.wire_type() as u8,
1842                    });
1843                }
1844                ::buffa::types::merge_string(&mut self.data_type, buf)?;
1845            }
1846            3u32 => {
1847                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1848                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1849                        field_number: 3u32,
1850                        expected: 0u8,
1851                        actual: tag.wire_type() as u8,
1852                    });
1853                }
1854                self.nullable = ::buffa::types::decode_bool(buf)?;
1855            }
1856            _ => {
1857                self.__buffa_unknown_fields
1858                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1859            }
1860        }
1861        ::core::result::Result::Ok(())
1862    }
1863    fn cached_size(&self) -> u32 {
1864        self.__buffa_cached_size.get()
1865    }
1866    fn clear(&mut self) {
1867        self.name.clear();
1868        self.data_type.clear();
1869        self.nullable = false;
1870        self.__buffa_unknown_fields.clear();
1871        self.__buffa_cached_size.set(0);
1872    }
1873}
1874impl ::buffa::ExtensionSet for Column {
1875    const PROTO_FQN: &'static str = "store.sql.v1.Column";
1876    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1877        &self.__buffa_unknown_fields
1878    }
1879    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1880        &mut self.__buffa_unknown_fields
1881    }
1882}
1883impl ::buffa::json_helpers::ProtoElemJson for Column {
1884    fn serialize_proto_json<S: ::serde::Serializer>(
1885        v: &Self,
1886        s: S,
1887    ) -> ::core::result::Result<S::Ok, S::Error> {
1888        ::serde::Serialize::serialize(v, s)
1889    }
1890    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1891        d: D,
1892    ) -> ::core::result::Result<Self, D::Error> {
1893        <Self as ::serde::Deserialize>::deserialize(d)
1894    }
1895}
1896#[doc(hidden)]
1897pub const __COLUMN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1898    type_url: "type.googleapis.com/store.sql.v1.Column",
1899    to_json: ::buffa::type_registry::any_to_json::<Column>,
1900    from_json: ::buffa::type_registry::any_from_json::<Column>,
1901    is_wkt: false,
1902};
1903/// One column of a registered `Table`.
1904#[derive(Clone, Debug, Default)]
1905pub struct ColumnView<'a> {
1906    /// Field 1: `name`
1907    pub name: &'a str,
1908    /// Arrow DataType rendered as its stable debug string (e.g. `Int64`,
1909    /// `Utf8`, `Timestamp(Microsecond, None)`, `Decimal128(38, 10)`). Clients
1910    /// that need typed handling should match against these exact strings.
1911    ///
1912    /// Field 2: `data_type`
1913    pub data_type: &'a str,
1914    /// Field 3: `nullable`
1915    pub nullable: bool,
1916    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1917}
1918impl<'a> ColumnView<'a> {
1919    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
1920    ///
1921    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
1922    /// and by generated sub-message decode arms with `depth - 1`.
1923    ///
1924    /// **Not part of the public API.** Named with a leading underscore to
1925    /// signal that it is for generated-code use only.
1926    #[doc(hidden)]
1927    pub fn _decode_depth(
1928        buf: &'a [u8],
1929        depth: u32,
1930    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1931        let mut view = Self::default();
1932        view._merge_into_view(buf, depth)?;
1933        ::core::result::Result::Ok(view)
1934    }
1935    /// Merge fields from `buf` into this view (proto merge semantics).
1936    ///
1937    /// Repeated fields append; singular fields last-wins; singular
1938    /// MESSAGE fields merge recursively. Used by sub-message decode
1939    /// arms when the same field appears multiple times on the wire.
1940    ///
1941    /// **Not part of the public API.**
1942    #[doc(hidden)]
1943    pub fn _merge_into_view(
1944        &mut self,
1945        buf: &'a [u8],
1946        depth: u32,
1947    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1948        let _ = depth;
1949        #[allow(unused_variables)]
1950        let view = self;
1951        let mut cur: &'a [u8] = buf;
1952        while !cur.is_empty() {
1953            let before_tag = cur;
1954            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1955            match tag.field_number() {
1956                1u32 => {
1957                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1958                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1959                            field_number: 1u32,
1960                            expected: 2u8,
1961                            actual: tag.wire_type() as u8,
1962                        });
1963                    }
1964                    view.name = ::buffa::types::borrow_str(&mut cur)?;
1965                }
1966                2u32 => {
1967                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1968                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1969                            field_number: 2u32,
1970                            expected: 2u8,
1971                            actual: tag.wire_type() as u8,
1972                        });
1973                    }
1974                    view.data_type = ::buffa::types::borrow_str(&mut cur)?;
1975                }
1976                3u32 => {
1977                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1978                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1979                            field_number: 3u32,
1980                            expected: 0u8,
1981                            actual: tag.wire_type() as u8,
1982                        });
1983                    }
1984                    view.nullable = ::buffa::types::decode_bool(&mut cur)?;
1985                }
1986                _ => {
1987                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1988                    let span_len = before_tag.len() - cur.len();
1989                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1990                }
1991            }
1992        }
1993        ::core::result::Result::Ok(())
1994    }
1995}
1996impl<'a> ::buffa::MessageView<'a> for ColumnView<'a> {
1997    type Owned = Column;
1998    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1999        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
2000    }
2001    fn decode_view_with_limit(
2002        buf: &'a [u8],
2003        depth: u32,
2004    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2005        Self::_decode_depth(buf, depth)
2006    }
2007    /// Convert this view to the owned message type.
2008    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
2009    fn to_owned_message(&self) -> Column {
2010        #[allow(unused_imports)]
2011        use ::buffa::alloc::string::ToString as _;
2012        Column {
2013            name: self.name.to_string(),
2014            data_type: self.data_type.to_string(),
2015            nullable: self.nullable,
2016            __buffa_unknown_fields: self
2017                .__buffa_unknown_fields
2018                .to_owned()
2019                .unwrap_or_default()
2020                .into(),
2021            ..::core::default::Default::default()
2022        }
2023    }
2024}
2025unsafe impl ::buffa::DefaultViewInstance for ColumnView<'static> {
2026    fn default_view_instance() -> &'static Self {
2027        static VALUE: ::buffa::__private::OnceBox<ColumnView<'static>> = ::buffa::__private::OnceBox::new();
2028        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2029    }
2030}
2031unsafe impl<'a> ::buffa::HasDefaultViewInstance for ColumnView<'a> {
2032    type Static = ColumnView<'static>;
2033}
2034/// Secondary index declared on a `Table`.
2035#[derive(Clone, PartialEq, Default)]
2036#[derive(::serde::Serialize, ::serde::Deserialize)]
2037#[serde(default)]
2038pub struct Index {
2039    /// Field 1: `name`
2040    #[serde(
2041        rename = "name",
2042        with = "::buffa::json_helpers::proto_string",
2043        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2044    )]
2045    pub name: ::buffa::alloc::string::String,
2046    /// Field 2: `layout`
2047    #[serde(
2048        rename = "layout",
2049        with = "::buffa::json_helpers::proto_enum",
2050        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2051    )]
2052    pub layout: ::buffa::EnumValue<IndexLayout>,
2053    /// Indices into `Table.columns` that make up the index key, in sort order.
2054    ///
2055    /// Field 3: `key_columns`
2056    #[serde(
2057        rename = "keyColumns",
2058        alias = "key_columns",
2059        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2060        deserialize_with = "::buffa::json_helpers::null_as_default"
2061    )]
2062    pub key_columns: ::buffa::alloc::vec::Vec<u32>,
2063    /// Additional column indices stored in the index payload so point lookups
2064    /// through this index don't need a base-row fetch ("covered" columns).
2065    ///
2066    /// Field 4: `cover_columns`
2067    #[serde(
2068        rename = "coverColumns",
2069        alias = "cover_columns",
2070        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2071        deserialize_with = "::buffa::json_helpers::null_as_default"
2072    )]
2073    pub cover_columns: ::buffa::alloc::vec::Vec<u32>,
2074    #[serde(skip)]
2075    #[doc(hidden)]
2076    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2077    #[doc(hidden)]
2078    #[serde(skip)]
2079    pub __buffa_cached_size: ::buffa::__private::CachedSize,
2080}
2081impl ::core::fmt::Debug for Index {
2082    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2083        f.debug_struct("Index")
2084            .field("name", &self.name)
2085            .field("layout", &self.layout)
2086            .field("key_columns", &self.key_columns)
2087            .field("cover_columns", &self.cover_columns)
2088            .finish()
2089    }
2090}
2091impl Index {
2092    /// Protobuf type URL for this message, for use with `Any::pack` and
2093    /// `Any::unpack_if`.
2094    ///
2095    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2096    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Index";
2097}
2098unsafe impl ::buffa::DefaultInstance for Index {
2099    fn default_instance() -> &'static Self {
2100        static VALUE: ::buffa::__private::OnceBox<Index> = ::buffa::__private::OnceBox::new();
2101        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2102    }
2103}
2104impl ::buffa::Message for Index {
2105    /// Returns the total encoded size in bytes.
2106    ///
2107    /// The result is a `u32`; the protobuf specification requires all
2108    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2109    /// compliant message will never overflow this type.
2110    fn compute_size(&self) -> u32 {
2111        #[allow(unused_imports)]
2112        use ::buffa::Enumeration as _;
2113        let mut size = 0u32;
2114        if !self.name.is_empty() {
2115            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
2116        }
2117        {
2118            let val = self.layout.to_i32();
2119            if val != 0 {
2120                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2121            }
2122        }
2123        if !self.key_columns.is_empty() {
2124            let payload: u32 = self
2125                .key_columns
2126                .iter()
2127                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
2128                .sum::<u32>();
2129            size
2130                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
2131        }
2132        if !self.cover_columns.is_empty() {
2133            let payload: u32 = self
2134                .cover_columns
2135                .iter()
2136                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
2137                .sum::<u32>();
2138            size
2139                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
2140        }
2141        size += self.__buffa_unknown_fields.encoded_len() as u32;
2142        self.__buffa_cached_size.set(size);
2143        size
2144    }
2145    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
2146        #[allow(unused_imports)]
2147        use ::buffa::Enumeration as _;
2148        if !self.name.is_empty() {
2149            ::buffa::encoding::Tag::new(
2150                    1u32,
2151                    ::buffa::encoding::WireType::LengthDelimited,
2152                )
2153                .encode(buf);
2154            ::buffa::types::encode_string(&self.name, buf);
2155        }
2156        {
2157            let val = self.layout.to_i32();
2158            if val != 0 {
2159                ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
2160                    .encode(buf);
2161                ::buffa::types::encode_int32(val, buf);
2162            }
2163        }
2164        if !self.key_columns.is_empty() {
2165            let payload: u32 = self
2166                .key_columns
2167                .iter()
2168                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
2169                .sum::<u32>();
2170            ::buffa::encoding::Tag::new(
2171                    3u32,
2172                    ::buffa::encoding::WireType::LengthDelimited,
2173                )
2174                .encode(buf);
2175            ::buffa::encoding::encode_varint(payload as u64, buf);
2176            for &v in &self.key_columns {
2177                ::buffa::types::encode_uint32(v, buf);
2178            }
2179        }
2180        if !self.cover_columns.is_empty() {
2181            let payload: u32 = self
2182                .cover_columns
2183                .iter()
2184                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
2185                .sum::<u32>();
2186            ::buffa::encoding::Tag::new(
2187                    4u32,
2188                    ::buffa::encoding::WireType::LengthDelimited,
2189                )
2190                .encode(buf);
2191            ::buffa::encoding::encode_varint(payload as u64, buf);
2192            for &v in &self.cover_columns {
2193                ::buffa::types::encode_uint32(v, buf);
2194            }
2195        }
2196        self.__buffa_unknown_fields.write_to(buf);
2197    }
2198    fn merge_field(
2199        &mut self,
2200        tag: ::buffa::encoding::Tag,
2201        buf: &mut impl ::buffa::bytes::Buf,
2202        depth: u32,
2203    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2204        #[allow(unused_imports)]
2205        use ::buffa::bytes::Buf as _;
2206        #[allow(unused_imports)]
2207        use ::buffa::Enumeration as _;
2208        match tag.field_number() {
2209            1u32 => {
2210                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2211                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2212                        field_number: 1u32,
2213                        expected: 2u8,
2214                        actual: tag.wire_type() as u8,
2215                    });
2216                }
2217                ::buffa::types::merge_string(&mut self.name, buf)?;
2218            }
2219            2u32 => {
2220                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2221                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2222                        field_number: 2u32,
2223                        expected: 0u8,
2224                        actual: tag.wire_type() as u8,
2225                    });
2226                }
2227                self.layout = ::buffa::EnumValue::from(
2228                    ::buffa::types::decode_int32(buf)?,
2229                );
2230            }
2231            3u32 => {
2232                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
2233                    let len = ::buffa::encoding::decode_varint(buf)?;
2234                    let len = usize::try_from(len)
2235                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
2236                    if buf.remaining() < len {
2237                        return ::core::result::Result::Err(
2238                            ::buffa::DecodeError::UnexpectedEof,
2239                        );
2240                    }
2241                    self.key_columns.reserve(len);
2242                    let mut limited = buf.take(len);
2243                    while limited.has_remaining() {
2244                        self.key_columns
2245                            .push(::buffa::types::decode_uint32(&mut limited)?);
2246                    }
2247                    let leftover = limited.remaining();
2248                    if leftover > 0 {
2249                        limited.advance(leftover);
2250                    }
2251                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
2252                    self.key_columns.push(::buffa::types::decode_uint32(buf)?);
2253                } else {
2254                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2255                        field_number: 3u32,
2256                        expected: 2u8,
2257                        actual: tag.wire_type() as u8,
2258                    });
2259                }
2260            }
2261            4u32 => {
2262                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
2263                    let len = ::buffa::encoding::decode_varint(buf)?;
2264                    let len = usize::try_from(len)
2265                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
2266                    if buf.remaining() < len {
2267                        return ::core::result::Result::Err(
2268                            ::buffa::DecodeError::UnexpectedEof,
2269                        );
2270                    }
2271                    self.cover_columns.reserve(len);
2272                    let mut limited = buf.take(len);
2273                    while limited.has_remaining() {
2274                        self.cover_columns
2275                            .push(::buffa::types::decode_uint32(&mut limited)?);
2276                    }
2277                    let leftover = limited.remaining();
2278                    if leftover > 0 {
2279                        limited.advance(leftover);
2280                    }
2281                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
2282                    self.cover_columns.push(::buffa::types::decode_uint32(buf)?);
2283                } else {
2284                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2285                        field_number: 4u32,
2286                        expected: 2u8,
2287                        actual: tag.wire_type() as u8,
2288                    });
2289                }
2290            }
2291            _ => {
2292                self.__buffa_unknown_fields
2293                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2294            }
2295        }
2296        ::core::result::Result::Ok(())
2297    }
2298    fn cached_size(&self) -> u32 {
2299        self.__buffa_cached_size.get()
2300    }
2301    fn clear(&mut self) {
2302        self.name.clear();
2303        self.layout = ::buffa::EnumValue::from(0);
2304        self.key_columns.clear();
2305        self.cover_columns.clear();
2306        self.__buffa_unknown_fields.clear();
2307        self.__buffa_cached_size.set(0);
2308    }
2309}
2310impl ::buffa::ExtensionSet for Index {
2311    const PROTO_FQN: &'static str = "store.sql.v1.Index";
2312    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2313        &self.__buffa_unknown_fields
2314    }
2315    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2316        &mut self.__buffa_unknown_fields
2317    }
2318}
2319impl ::buffa::json_helpers::ProtoElemJson for Index {
2320    fn serialize_proto_json<S: ::serde::Serializer>(
2321        v: &Self,
2322        s: S,
2323    ) -> ::core::result::Result<S::Ok, S::Error> {
2324        ::serde::Serialize::serialize(v, s)
2325    }
2326    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2327        d: D,
2328    ) -> ::core::result::Result<Self, D::Error> {
2329        <Self as ::serde::Deserialize>::deserialize(d)
2330    }
2331}
2332#[doc(hidden)]
2333pub const __INDEX_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2334    type_url: "type.googleapis.com/store.sql.v1.Index",
2335    to_json: ::buffa::type_registry::any_to_json::<Index>,
2336    from_json: ::buffa::type_registry::any_from_json::<Index>,
2337    is_wkt: false,
2338};
2339/// Secondary index declared on a `Table`.
2340#[derive(Clone, Debug, Default)]
2341pub struct IndexView<'a> {
2342    /// Field 1: `name`
2343    pub name: &'a str,
2344    /// Field 2: `layout`
2345    pub layout: ::buffa::EnumValue<IndexLayout>,
2346    /// Indices into `Table.columns` that make up the index key, in sort order.
2347    ///
2348    /// Field 3: `key_columns`
2349    pub key_columns: ::buffa::RepeatedView<'a, u32>,
2350    /// Additional column indices stored in the index payload so point lookups
2351    /// through this index don't need a base-row fetch ("covered" columns).
2352    ///
2353    /// Field 4: `cover_columns`
2354    pub cover_columns: ::buffa::RepeatedView<'a, u32>,
2355    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2356}
2357impl<'a> IndexView<'a> {
2358    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
2359    ///
2360    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
2361    /// and by generated sub-message decode arms with `depth - 1`.
2362    ///
2363    /// **Not part of the public API.** Named with a leading underscore to
2364    /// signal that it is for generated-code use only.
2365    #[doc(hidden)]
2366    pub fn _decode_depth(
2367        buf: &'a [u8],
2368        depth: u32,
2369    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2370        let mut view = Self::default();
2371        view._merge_into_view(buf, depth)?;
2372        ::core::result::Result::Ok(view)
2373    }
2374    /// Merge fields from `buf` into this view (proto merge semantics).
2375    ///
2376    /// Repeated fields append; singular fields last-wins; singular
2377    /// MESSAGE fields merge recursively. Used by sub-message decode
2378    /// arms when the same field appears multiple times on the wire.
2379    ///
2380    /// **Not part of the public API.**
2381    #[doc(hidden)]
2382    pub fn _merge_into_view(
2383        &mut self,
2384        buf: &'a [u8],
2385        depth: u32,
2386    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2387        let _ = depth;
2388        #[allow(unused_variables)]
2389        let view = self;
2390        let mut cur: &'a [u8] = buf;
2391        while !cur.is_empty() {
2392            let before_tag = cur;
2393            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
2394            match tag.field_number() {
2395                1u32 => {
2396                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2397                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2398                            field_number: 1u32,
2399                            expected: 2u8,
2400                            actual: tag.wire_type() as u8,
2401                        });
2402                    }
2403                    view.name = ::buffa::types::borrow_str(&mut cur)?;
2404                }
2405                2u32 => {
2406                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2407                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2408                            field_number: 2u32,
2409                            expected: 0u8,
2410                            actual: tag.wire_type() as u8,
2411                        });
2412                    }
2413                    view.layout = ::buffa::EnumValue::from(
2414                        ::buffa::types::decode_int32(&mut cur)?,
2415                    );
2416                }
2417                3u32 => {
2418                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
2419                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
2420                        let mut pcur: &[u8] = payload;
2421                        while !pcur.is_empty() {
2422                            view.key_columns
2423                                .push(::buffa::types::decode_uint32(&mut pcur)?);
2424                        }
2425                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
2426                        view.key_columns.push(::buffa::types::decode_uint32(&mut cur)?);
2427                    } else {
2428                        return Err(::buffa::DecodeError::WireTypeMismatch {
2429                            field_number: 3u32,
2430                            expected: 2u8,
2431                            actual: tag.wire_type() as u8,
2432                        });
2433                    }
2434                }
2435                4u32 => {
2436                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
2437                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
2438                        let mut pcur: &[u8] = payload;
2439                        while !pcur.is_empty() {
2440                            view.cover_columns
2441                                .push(::buffa::types::decode_uint32(&mut pcur)?);
2442                        }
2443                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
2444                        view.cover_columns
2445                            .push(::buffa::types::decode_uint32(&mut cur)?);
2446                    } else {
2447                        return Err(::buffa::DecodeError::WireTypeMismatch {
2448                            field_number: 4u32,
2449                            expected: 2u8,
2450                            actual: tag.wire_type() as u8,
2451                        });
2452                    }
2453                }
2454                _ => {
2455                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
2456                    let span_len = before_tag.len() - cur.len();
2457                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
2458                }
2459            }
2460        }
2461        ::core::result::Result::Ok(())
2462    }
2463}
2464impl<'a> ::buffa::MessageView<'a> for IndexView<'a> {
2465    type Owned = Index;
2466    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2467        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
2468    }
2469    fn decode_view_with_limit(
2470        buf: &'a [u8],
2471        depth: u32,
2472    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2473        Self::_decode_depth(buf, depth)
2474    }
2475    /// Convert this view to the owned message type.
2476    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
2477    fn to_owned_message(&self) -> Index {
2478        #[allow(unused_imports)]
2479        use ::buffa::alloc::string::ToString as _;
2480        Index {
2481            name: self.name.to_string(),
2482            layout: self.layout,
2483            key_columns: self.key_columns.to_vec(),
2484            cover_columns: self.cover_columns.to_vec(),
2485            __buffa_unknown_fields: self
2486                .__buffa_unknown_fields
2487                .to_owned()
2488                .unwrap_or_default()
2489                .into(),
2490            ..::core::default::Default::default()
2491        }
2492    }
2493}
2494unsafe impl ::buffa::DefaultViewInstance for IndexView<'static> {
2495    fn default_view_instance() -> &'static Self {
2496        static VALUE: ::buffa::__private::OnceBox<IndexView<'static>> = ::buffa::__private::OnceBox::new();
2497        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2498    }
2499}
2500unsafe impl<'a> ::buffa::HasDefaultViewInstance for IndexView<'a> {
2501    type Static = IndexView<'static>;
2502}
2503/// Ad-hoc SQL statement.
2504#[derive(Clone, PartialEq, Default)]
2505#[derive(::serde::Serialize, ::serde::Deserialize)]
2506#[serde(default)]
2507pub struct QueryRequest {
2508    /// Field 1: `sql`
2509    #[serde(
2510        rename = "sql",
2511        with = "::buffa::json_helpers::proto_string",
2512        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2513    )]
2514    pub sql: ::buffa::alloc::string::String,
2515    #[serde(skip)]
2516    #[doc(hidden)]
2517    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2518    #[doc(hidden)]
2519    #[serde(skip)]
2520    pub __buffa_cached_size: ::buffa::__private::CachedSize,
2521}
2522impl ::core::fmt::Debug for QueryRequest {
2523    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2524        f.debug_struct("QueryRequest").field("sql", &self.sql).finish()
2525    }
2526}
2527impl QueryRequest {
2528    /// Protobuf type URL for this message, for use with `Any::pack` and
2529    /// `Any::unpack_if`.
2530    ///
2531    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2532    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.QueryRequest";
2533}
2534unsafe impl ::buffa::DefaultInstance for QueryRequest {
2535    fn default_instance() -> &'static Self {
2536        static VALUE: ::buffa::__private::OnceBox<QueryRequest> = ::buffa::__private::OnceBox::new();
2537        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2538    }
2539}
2540impl ::buffa::Message for QueryRequest {
2541    /// Returns the total encoded size in bytes.
2542    ///
2543    /// The result is a `u32`; the protobuf specification requires all
2544    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2545    /// compliant message will never overflow this type.
2546    fn compute_size(&self) -> u32 {
2547        #[allow(unused_imports)]
2548        use ::buffa::Enumeration as _;
2549        let mut size = 0u32;
2550        if !self.sql.is_empty() {
2551            size += 1u32 + ::buffa::types::string_encoded_len(&self.sql) as u32;
2552        }
2553        size += self.__buffa_unknown_fields.encoded_len() as u32;
2554        self.__buffa_cached_size.set(size);
2555        size
2556    }
2557    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
2558        #[allow(unused_imports)]
2559        use ::buffa::Enumeration as _;
2560        if !self.sql.is_empty() {
2561            ::buffa::encoding::Tag::new(
2562                    1u32,
2563                    ::buffa::encoding::WireType::LengthDelimited,
2564                )
2565                .encode(buf);
2566            ::buffa::types::encode_string(&self.sql, buf);
2567        }
2568        self.__buffa_unknown_fields.write_to(buf);
2569    }
2570    fn merge_field(
2571        &mut self,
2572        tag: ::buffa::encoding::Tag,
2573        buf: &mut impl ::buffa::bytes::Buf,
2574        depth: u32,
2575    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2576        #[allow(unused_imports)]
2577        use ::buffa::bytes::Buf as _;
2578        #[allow(unused_imports)]
2579        use ::buffa::Enumeration as _;
2580        match tag.field_number() {
2581            1u32 => {
2582                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2583                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2584                        field_number: 1u32,
2585                        expected: 2u8,
2586                        actual: tag.wire_type() as u8,
2587                    });
2588                }
2589                ::buffa::types::merge_string(&mut self.sql, buf)?;
2590            }
2591            _ => {
2592                self.__buffa_unknown_fields
2593                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2594            }
2595        }
2596        ::core::result::Result::Ok(())
2597    }
2598    fn cached_size(&self) -> u32 {
2599        self.__buffa_cached_size.get()
2600    }
2601    fn clear(&mut self) {
2602        self.sql.clear();
2603        self.__buffa_unknown_fields.clear();
2604        self.__buffa_cached_size.set(0);
2605    }
2606}
2607impl ::buffa::ExtensionSet for QueryRequest {
2608    const PROTO_FQN: &'static str = "store.sql.v1.QueryRequest";
2609    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2610        &self.__buffa_unknown_fields
2611    }
2612    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2613        &mut self.__buffa_unknown_fields
2614    }
2615}
2616impl ::buffa::json_helpers::ProtoElemJson for QueryRequest {
2617    fn serialize_proto_json<S: ::serde::Serializer>(
2618        v: &Self,
2619        s: S,
2620    ) -> ::core::result::Result<S::Ok, S::Error> {
2621        ::serde::Serialize::serialize(v, s)
2622    }
2623    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2624        d: D,
2625    ) -> ::core::result::Result<Self, D::Error> {
2626        <Self as ::serde::Deserialize>::deserialize(d)
2627    }
2628}
2629#[doc(hidden)]
2630pub const __QUERY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2631    type_url: "type.googleapis.com/store.sql.v1.QueryRequest",
2632    to_json: ::buffa::type_registry::any_to_json::<QueryRequest>,
2633    from_json: ::buffa::type_registry::any_from_json::<QueryRequest>,
2634    is_wkt: false,
2635};
2636/// Ad-hoc SQL statement.
2637#[derive(Clone, Debug, Default)]
2638pub struct QueryRequestView<'a> {
2639    /// Field 1: `sql`
2640    pub sql: &'a str,
2641    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2642}
2643impl<'a> QueryRequestView<'a> {
2644    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
2645    ///
2646    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
2647    /// and by generated sub-message decode arms with `depth - 1`.
2648    ///
2649    /// **Not part of the public API.** Named with a leading underscore to
2650    /// signal that it is for generated-code use only.
2651    #[doc(hidden)]
2652    pub fn _decode_depth(
2653        buf: &'a [u8],
2654        depth: u32,
2655    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2656        let mut view = Self::default();
2657        view._merge_into_view(buf, depth)?;
2658        ::core::result::Result::Ok(view)
2659    }
2660    /// Merge fields from `buf` into this view (proto merge semantics).
2661    ///
2662    /// Repeated fields append; singular fields last-wins; singular
2663    /// MESSAGE fields merge recursively. Used by sub-message decode
2664    /// arms when the same field appears multiple times on the wire.
2665    ///
2666    /// **Not part of the public API.**
2667    #[doc(hidden)]
2668    pub fn _merge_into_view(
2669        &mut self,
2670        buf: &'a [u8],
2671        depth: u32,
2672    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2673        let _ = depth;
2674        #[allow(unused_variables)]
2675        let view = self;
2676        let mut cur: &'a [u8] = buf;
2677        while !cur.is_empty() {
2678            let before_tag = cur;
2679            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
2680            match tag.field_number() {
2681                1u32 => {
2682                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2683                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2684                            field_number: 1u32,
2685                            expected: 2u8,
2686                            actual: tag.wire_type() as u8,
2687                        });
2688                    }
2689                    view.sql = ::buffa::types::borrow_str(&mut cur)?;
2690                }
2691                _ => {
2692                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
2693                    let span_len = before_tag.len() - cur.len();
2694                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
2695                }
2696            }
2697        }
2698        ::core::result::Result::Ok(())
2699    }
2700}
2701impl<'a> ::buffa::MessageView<'a> for QueryRequestView<'a> {
2702    type Owned = QueryRequest;
2703    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2704        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
2705    }
2706    fn decode_view_with_limit(
2707        buf: &'a [u8],
2708        depth: u32,
2709    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2710        Self::_decode_depth(buf, depth)
2711    }
2712    /// Convert this view to the owned message type.
2713    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
2714    fn to_owned_message(&self) -> QueryRequest {
2715        #[allow(unused_imports)]
2716        use ::buffa::alloc::string::ToString as _;
2717        QueryRequest {
2718            sql: self.sql.to_string(),
2719            __buffa_unknown_fields: self
2720                .__buffa_unknown_fields
2721                .to_owned()
2722                .unwrap_or_default()
2723                .into(),
2724            ..::core::default::Default::default()
2725        }
2726    }
2727}
2728unsafe impl ::buffa::DefaultViewInstance for QueryRequestView<'static> {
2729    fn default_view_instance() -> &'static Self {
2730        static VALUE: ::buffa::__private::OnceBox<QueryRequestView<'static>> = ::buffa::__private::OnceBox::new();
2731        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2732    }
2733}
2734unsafe impl<'a> ::buffa::HasDefaultViewInstance for QueryRequestView<'a> {
2735    type Static = QueryRequestView<'static>;
2736}
2737/// Result set from `Query`.
2738#[derive(Clone, PartialEq, Default)]
2739#[derive(::serde::Serialize, ::serde::Deserialize)]
2740#[serde(default)]
2741pub struct QueryResponse {
2742    /// Field 1: `column`
2743    #[serde(
2744        rename = "column",
2745        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2746        deserialize_with = "::buffa::json_helpers::null_as_default"
2747    )]
2748    pub column: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
2749    /// Field 2: `rows`
2750    #[serde(
2751        rename = "rows",
2752        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2753        deserialize_with = "::buffa::json_helpers::null_as_default"
2754    )]
2755    pub rows: ::buffa::alloc::vec::Vec<Row>,
2756    #[serde(skip)]
2757    #[doc(hidden)]
2758    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2759    #[doc(hidden)]
2760    #[serde(skip)]
2761    pub __buffa_cached_size: ::buffa::__private::CachedSize,
2762}
2763impl ::core::fmt::Debug for QueryResponse {
2764    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2765        f.debug_struct("QueryResponse")
2766            .field("column", &self.column)
2767            .field("rows", &self.rows)
2768            .finish()
2769    }
2770}
2771impl QueryResponse {
2772    /// Protobuf type URL for this message, for use with `Any::pack` and
2773    /// `Any::unpack_if`.
2774    ///
2775    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2776    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.QueryResponse";
2777}
2778unsafe impl ::buffa::DefaultInstance for QueryResponse {
2779    fn default_instance() -> &'static Self {
2780        static VALUE: ::buffa::__private::OnceBox<QueryResponse> = ::buffa::__private::OnceBox::new();
2781        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2782    }
2783}
2784impl ::buffa::Message for QueryResponse {
2785    /// Returns the total encoded size in bytes.
2786    ///
2787    /// The result is a `u32`; the protobuf specification requires all
2788    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2789    /// compliant message will never overflow this type.
2790    fn compute_size(&self) -> u32 {
2791        #[allow(unused_imports)]
2792        use ::buffa::Enumeration as _;
2793        let mut size = 0u32;
2794        for v in &self.column {
2795            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
2796        }
2797        for v in &self.rows {
2798            let inner_size = v.compute_size();
2799            size
2800                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2801                    + inner_size;
2802        }
2803        size += self.__buffa_unknown_fields.encoded_len() as u32;
2804        self.__buffa_cached_size.set(size);
2805        size
2806    }
2807    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
2808        #[allow(unused_imports)]
2809        use ::buffa::Enumeration as _;
2810        for v in &self.column {
2811            ::buffa::encoding::Tag::new(
2812                    1u32,
2813                    ::buffa::encoding::WireType::LengthDelimited,
2814                )
2815                .encode(buf);
2816            ::buffa::types::encode_string(v, buf);
2817        }
2818        for v in &self.rows {
2819            ::buffa::encoding::Tag::new(
2820                    2u32,
2821                    ::buffa::encoding::WireType::LengthDelimited,
2822                )
2823                .encode(buf);
2824            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
2825            v.write_to(buf);
2826        }
2827        self.__buffa_unknown_fields.write_to(buf);
2828    }
2829    fn merge_field(
2830        &mut self,
2831        tag: ::buffa::encoding::Tag,
2832        buf: &mut impl ::buffa::bytes::Buf,
2833        depth: u32,
2834    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2835        #[allow(unused_imports)]
2836        use ::buffa::bytes::Buf as _;
2837        #[allow(unused_imports)]
2838        use ::buffa::Enumeration as _;
2839        match tag.field_number() {
2840            1u32 => {
2841                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2842                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2843                        field_number: 1u32,
2844                        expected: 2u8,
2845                        actual: tag.wire_type() as u8,
2846                    });
2847                }
2848                self.column.push(::buffa::types::decode_string(buf)?);
2849            }
2850            2u32 => {
2851                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2852                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2853                        field_number: 2u32,
2854                        expected: 2u8,
2855                        actual: tag.wire_type() as u8,
2856                    });
2857                }
2858                let mut elem = ::core::default::Default::default();
2859                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2860                self.rows.push(elem);
2861            }
2862            _ => {
2863                self.__buffa_unknown_fields
2864                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2865            }
2866        }
2867        ::core::result::Result::Ok(())
2868    }
2869    fn cached_size(&self) -> u32 {
2870        self.__buffa_cached_size.get()
2871    }
2872    fn clear(&mut self) {
2873        self.column.clear();
2874        self.rows.clear();
2875        self.__buffa_unknown_fields.clear();
2876        self.__buffa_cached_size.set(0);
2877    }
2878}
2879impl ::buffa::ExtensionSet for QueryResponse {
2880    const PROTO_FQN: &'static str = "store.sql.v1.QueryResponse";
2881    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2882        &self.__buffa_unknown_fields
2883    }
2884    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2885        &mut self.__buffa_unknown_fields
2886    }
2887}
2888impl ::buffa::json_helpers::ProtoElemJson for QueryResponse {
2889    fn serialize_proto_json<S: ::serde::Serializer>(
2890        v: &Self,
2891        s: S,
2892    ) -> ::core::result::Result<S::Ok, S::Error> {
2893        ::serde::Serialize::serialize(v, s)
2894    }
2895    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2896        d: D,
2897    ) -> ::core::result::Result<Self, D::Error> {
2898        <Self as ::serde::Deserialize>::deserialize(d)
2899    }
2900}
2901#[doc(hidden)]
2902pub const __QUERY_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2903    type_url: "type.googleapis.com/store.sql.v1.QueryResponse",
2904    to_json: ::buffa::type_registry::any_to_json::<QueryResponse>,
2905    from_json: ::buffa::type_registry::any_from_json::<QueryResponse>,
2906    is_wkt: false,
2907};
2908/// Result set from `Query`.
2909#[derive(Clone, Debug, Default)]
2910pub struct QueryResponseView<'a> {
2911    /// Field 1: `column`
2912    pub column: ::buffa::RepeatedView<'a, &'a str>,
2913    /// Field 2: `rows`
2914    pub rows: ::buffa::RepeatedView<'a, RowView<'a>>,
2915    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2916}
2917impl<'a> QueryResponseView<'a> {
2918    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
2919    ///
2920    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
2921    /// and by generated sub-message decode arms with `depth - 1`.
2922    ///
2923    /// **Not part of the public API.** Named with a leading underscore to
2924    /// signal that it is for generated-code use only.
2925    #[doc(hidden)]
2926    pub fn _decode_depth(
2927        buf: &'a [u8],
2928        depth: u32,
2929    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2930        let mut view = Self::default();
2931        view._merge_into_view(buf, depth)?;
2932        ::core::result::Result::Ok(view)
2933    }
2934    /// Merge fields from `buf` into this view (proto merge semantics).
2935    ///
2936    /// Repeated fields append; singular fields last-wins; singular
2937    /// MESSAGE fields merge recursively. Used by sub-message decode
2938    /// arms when the same field appears multiple times on the wire.
2939    ///
2940    /// **Not part of the public API.**
2941    #[doc(hidden)]
2942    pub fn _merge_into_view(
2943        &mut self,
2944        buf: &'a [u8],
2945        depth: u32,
2946    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2947        let _ = depth;
2948        #[allow(unused_variables)]
2949        let view = self;
2950        let mut cur: &'a [u8] = buf;
2951        while !cur.is_empty() {
2952            let before_tag = cur;
2953            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
2954            match tag.field_number() {
2955                1u32 => {
2956                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2957                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2958                            field_number: 1u32,
2959                            expected: 2u8,
2960                            actual: tag.wire_type() as u8,
2961                        });
2962                    }
2963                    view.column.push(::buffa::types::borrow_str(&mut cur)?);
2964                }
2965                2u32 => {
2966                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2967                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2968                            field_number: 2u32,
2969                            expected: 2u8,
2970                            actual: tag.wire_type() as u8,
2971                        });
2972                    }
2973                    if depth == 0 {
2974                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
2975                    }
2976                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2977                    view.rows.push(RowView::_decode_depth(sub, depth - 1)?);
2978                }
2979                _ => {
2980                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
2981                    let span_len = before_tag.len() - cur.len();
2982                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
2983                }
2984            }
2985        }
2986        ::core::result::Result::Ok(())
2987    }
2988}
2989impl<'a> ::buffa::MessageView<'a> for QueryResponseView<'a> {
2990    type Owned = QueryResponse;
2991    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2992        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
2993    }
2994    fn decode_view_with_limit(
2995        buf: &'a [u8],
2996        depth: u32,
2997    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2998        Self::_decode_depth(buf, depth)
2999    }
3000    /// Convert this view to the owned message type.
3001    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
3002    fn to_owned_message(&self) -> QueryResponse {
3003        #[allow(unused_imports)]
3004        use ::buffa::alloc::string::ToString as _;
3005        QueryResponse {
3006            column: self.column.iter().map(|s| s.to_string()).collect(),
3007            rows: self.rows.iter().map(|v| v.to_owned_message()).collect(),
3008            __buffa_unknown_fields: self
3009                .__buffa_unknown_fields
3010                .to_owned()
3011                .unwrap_or_default()
3012                .into(),
3013            ..::core::default::Default::default()
3014        }
3015    }
3016}
3017unsafe impl ::buffa::DefaultViewInstance for QueryResponseView<'static> {
3018    fn default_view_instance() -> &'static Self {
3019        static VALUE: ::buffa::__private::OnceBox<QueryResponseView<'static>> = ::buffa::__private::OnceBox::new();
3020        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3021    }
3022}
3023unsafe impl<'a> ::buffa::HasDefaultViewInstance for QueryResponseView<'a> {
3024    type Static = QueryResponseView<'static>;
3025}
3026/// Typed row. `cells[i]` aligns with `column[i]` in the parent message.
3027#[derive(Clone, PartialEq, Default)]
3028#[derive(::serde::Serialize, ::serde::Deserialize)]
3029#[serde(default)]
3030pub struct Row {
3031    /// Field 1: `cells`
3032    #[serde(
3033        rename = "cells",
3034        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
3035        deserialize_with = "::buffa::json_helpers::null_as_default"
3036    )]
3037    pub cells: ::buffa::alloc::vec::Vec<Cell>,
3038    #[serde(skip)]
3039    #[doc(hidden)]
3040    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3041    #[doc(hidden)]
3042    #[serde(skip)]
3043    pub __buffa_cached_size: ::buffa::__private::CachedSize,
3044}
3045impl ::core::fmt::Debug for Row {
3046    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3047        f.debug_struct("Row").field("cells", &self.cells).finish()
3048    }
3049}
3050impl Row {
3051    /// Protobuf type URL for this message, for use with `Any::pack` and
3052    /// `Any::unpack_if`.
3053    ///
3054    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3055    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Row";
3056}
3057unsafe impl ::buffa::DefaultInstance for Row {
3058    fn default_instance() -> &'static Self {
3059        static VALUE: ::buffa::__private::OnceBox<Row> = ::buffa::__private::OnceBox::new();
3060        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3061    }
3062}
3063impl ::buffa::Message for Row {
3064    /// Returns the total encoded size in bytes.
3065    ///
3066    /// The result is a `u32`; the protobuf specification requires all
3067    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3068    /// compliant message will never overflow this type.
3069    fn compute_size(&self) -> u32 {
3070        #[allow(unused_imports)]
3071        use ::buffa::Enumeration as _;
3072        let mut size = 0u32;
3073        for v in &self.cells {
3074            let inner_size = v.compute_size();
3075            size
3076                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3077                    + inner_size;
3078        }
3079        size += self.__buffa_unknown_fields.encoded_len() as u32;
3080        self.__buffa_cached_size.set(size);
3081        size
3082    }
3083    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
3084        #[allow(unused_imports)]
3085        use ::buffa::Enumeration as _;
3086        for v in &self.cells {
3087            ::buffa::encoding::Tag::new(
3088                    1u32,
3089                    ::buffa::encoding::WireType::LengthDelimited,
3090                )
3091                .encode(buf);
3092            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
3093            v.write_to(buf);
3094        }
3095        self.__buffa_unknown_fields.write_to(buf);
3096    }
3097    fn merge_field(
3098        &mut self,
3099        tag: ::buffa::encoding::Tag,
3100        buf: &mut impl ::buffa::bytes::Buf,
3101        depth: u32,
3102    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3103        #[allow(unused_imports)]
3104        use ::buffa::bytes::Buf as _;
3105        #[allow(unused_imports)]
3106        use ::buffa::Enumeration as _;
3107        match tag.field_number() {
3108            1u32 => {
3109                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3110                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3111                        field_number: 1u32,
3112                        expected: 2u8,
3113                        actual: tag.wire_type() as u8,
3114                    });
3115                }
3116                let mut elem = ::core::default::Default::default();
3117                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
3118                self.cells.push(elem);
3119            }
3120            _ => {
3121                self.__buffa_unknown_fields
3122                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
3123            }
3124        }
3125        ::core::result::Result::Ok(())
3126    }
3127    fn cached_size(&self) -> u32 {
3128        self.__buffa_cached_size.get()
3129    }
3130    fn clear(&mut self) {
3131        self.cells.clear();
3132        self.__buffa_unknown_fields.clear();
3133        self.__buffa_cached_size.set(0);
3134    }
3135}
3136impl ::buffa::ExtensionSet for Row {
3137    const PROTO_FQN: &'static str = "store.sql.v1.Row";
3138    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3139        &self.__buffa_unknown_fields
3140    }
3141    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3142        &mut self.__buffa_unknown_fields
3143    }
3144}
3145impl ::buffa::json_helpers::ProtoElemJson for Row {
3146    fn serialize_proto_json<S: ::serde::Serializer>(
3147        v: &Self,
3148        s: S,
3149    ) -> ::core::result::Result<S::Ok, S::Error> {
3150        ::serde::Serialize::serialize(v, s)
3151    }
3152    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3153        d: D,
3154    ) -> ::core::result::Result<Self, D::Error> {
3155        <Self as ::serde::Deserialize>::deserialize(d)
3156    }
3157}
3158#[doc(hidden)]
3159pub const __ROW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3160    type_url: "type.googleapis.com/store.sql.v1.Row",
3161    to_json: ::buffa::type_registry::any_to_json::<Row>,
3162    from_json: ::buffa::type_registry::any_from_json::<Row>,
3163    is_wkt: false,
3164};
3165/// Typed row. `cells[i]` aligns with `column[i]` in the parent message.
3166#[derive(Clone, Debug, Default)]
3167pub struct RowView<'a> {
3168    /// Field 1: `cells`
3169    pub cells: ::buffa::RepeatedView<'a, CellView<'a>>,
3170    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3171}
3172impl<'a> RowView<'a> {
3173    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
3174    ///
3175    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
3176    /// and by generated sub-message decode arms with `depth - 1`.
3177    ///
3178    /// **Not part of the public API.** Named with a leading underscore to
3179    /// signal that it is for generated-code use only.
3180    #[doc(hidden)]
3181    pub fn _decode_depth(
3182        buf: &'a [u8],
3183        depth: u32,
3184    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3185        let mut view = Self::default();
3186        view._merge_into_view(buf, depth)?;
3187        ::core::result::Result::Ok(view)
3188    }
3189    /// Merge fields from `buf` into this view (proto merge semantics).
3190    ///
3191    /// Repeated fields append; singular fields last-wins; singular
3192    /// MESSAGE fields merge recursively. Used by sub-message decode
3193    /// arms when the same field appears multiple times on the wire.
3194    ///
3195    /// **Not part of the public API.**
3196    #[doc(hidden)]
3197    pub fn _merge_into_view(
3198        &mut self,
3199        buf: &'a [u8],
3200        depth: u32,
3201    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3202        let _ = depth;
3203        #[allow(unused_variables)]
3204        let view = self;
3205        let mut cur: &'a [u8] = buf;
3206        while !cur.is_empty() {
3207            let before_tag = cur;
3208            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
3209            match tag.field_number() {
3210                1u32 => {
3211                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3212                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3213                            field_number: 1u32,
3214                            expected: 2u8,
3215                            actual: tag.wire_type() as u8,
3216                        });
3217                    }
3218                    if depth == 0 {
3219                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
3220                    }
3221                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
3222                    view.cells.push(CellView::_decode_depth(sub, depth - 1)?);
3223                }
3224                _ => {
3225                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
3226                    let span_len = before_tag.len() - cur.len();
3227                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
3228                }
3229            }
3230        }
3231        ::core::result::Result::Ok(())
3232    }
3233}
3234impl<'a> ::buffa::MessageView<'a> for RowView<'a> {
3235    type Owned = Row;
3236    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3237        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
3238    }
3239    fn decode_view_with_limit(
3240        buf: &'a [u8],
3241        depth: u32,
3242    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3243        Self::_decode_depth(buf, depth)
3244    }
3245    /// Convert this view to the owned message type.
3246    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
3247    fn to_owned_message(&self) -> Row {
3248        #[allow(unused_imports)]
3249        use ::buffa::alloc::string::ToString as _;
3250        Row {
3251            cells: self.cells.iter().map(|v| v.to_owned_message()).collect(),
3252            __buffa_unknown_fields: self
3253                .__buffa_unknown_fields
3254                .to_owned()
3255                .unwrap_or_default()
3256                .into(),
3257            ..::core::default::Default::default()
3258        }
3259    }
3260}
3261unsafe impl ::buffa::DefaultViewInstance for RowView<'static> {
3262    fn default_view_instance() -> &'static Self {
3263        static VALUE: ::buffa::__private::OnceBox<RowView<'static>> = ::buffa::__private::OnceBox::new();
3264        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3265    }
3266}
3267unsafe impl<'a> ::buffa::HasDefaultViewInstance for RowView<'a> {
3268    type Static = RowView<'static>;
3269}
3270/// Explicit NULL marker for SQL NULL cells. Distinct from a `Cell` whose
3271/// `kind` oneof is unset — that indicates a malformed wire message, not NULL.
3272#[derive(Clone, PartialEq, Default)]
3273#[derive(::serde::Serialize, ::serde::Deserialize)]
3274#[serde(default)]
3275pub struct Null {
3276    #[serde(skip)]
3277    #[doc(hidden)]
3278    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3279    #[doc(hidden)]
3280    #[serde(skip)]
3281    pub __buffa_cached_size: ::buffa::__private::CachedSize,
3282}
3283impl ::core::fmt::Debug for Null {
3284    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3285        f.debug_struct("Null").finish()
3286    }
3287}
3288impl Null {
3289    /// Protobuf type URL for this message, for use with `Any::pack` and
3290    /// `Any::unpack_if`.
3291    ///
3292    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3293    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Null";
3294}
3295unsafe impl ::buffa::DefaultInstance for Null {
3296    fn default_instance() -> &'static Self {
3297        static VALUE: ::buffa::__private::OnceBox<Null> = ::buffa::__private::OnceBox::new();
3298        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3299    }
3300}
3301impl ::buffa::Message for Null {
3302    /// Returns the total encoded size in bytes.
3303    ///
3304    /// The result is a `u32`; the protobuf specification requires all
3305    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3306    /// compliant message will never overflow this type.
3307    fn compute_size(&self) -> u32 {
3308        #[allow(unused_imports)]
3309        use ::buffa::Enumeration as _;
3310        let mut size = 0u32;
3311        size += self.__buffa_unknown_fields.encoded_len() as u32;
3312        self.__buffa_cached_size.set(size);
3313        size
3314    }
3315    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
3316        #[allow(unused_imports)]
3317        use ::buffa::Enumeration as _;
3318        self.__buffa_unknown_fields.write_to(buf);
3319    }
3320    fn merge_field(
3321        &mut self,
3322        tag: ::buffa::encoding::Tag,
3323        buf: &mut impl ::buffa::bytes::Buf,
3324        depth: u32,
3325    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3326        #[allow(unused_imports)]
3327        use ::buffa::bytes::Buf as _;
3328        #[allow(unused_imports)]
3329        use ::buffa::Enumeration as _;
3330        match tag.field_number() {
3331            _ => {
3332                self.__buffa_unknown_fields
3333                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
3334            }
3335        }
3336        ::core::result::Result::Ok(())
3337    }
3338    fn cached_size(&self) -> u32 {
3339        self.__buffa_cached_size.get()
3340    }
3341    fn clear(&mut self) {
3342        self.__buffa_unknown_fields.clear();
3343        self.__buffa_cached_size.set(0);
3344    }
3345}
3346impl ::buffa::ExtensionSet for Null {
3347    const PROTO_FQN: &'static str = "store.sql.v1.Null";
3348    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3349        &self.__buffa_unknown_fields
3350    }
3351    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3352        &mut self.__buffa_unknown_fields
3353    }
3354}
3355impl ::buffa::json_helpers::ProtoElemJson for Null {
3356    fn serialize_proto_json<S: ::serde::Serializer>(
3357        v: &Self,
3358        s: S,
3359    ) -> ::core::result::Result<S::Ok, S::Error> {
3360        ::serde::Serialize::serialize(v, s)
3361    }
3362    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3363        d: D,
3364    ) -> ::core::result::Result<Self, D::Error> {
3365        <Self as ::serde::Deserialize>::deserialize(d)
3366    }
3367}
3368#[doc(hidden)]
3369pub const __NULL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3370    type_url: "type.googleapis.com/store.sql.v1.Null",
3371    to_json: ::buffa::type_registry::any_to_json::<Null>,
3372    from_json: ::buffa::type_registry::any_from_json::<Null>,
3373    is_wkt: false,
3374};
3375/// Explicit NULL marker for SQL NULL cells. Distinct from a `Cell` whose
3376/// `kind` oneof is unset — that indicates a malformed wire message, not NULL.
3377#[derive(Clone, Debug, Default)]
3378pub struct NullView<'a> {
3379    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3380}
3381impl<'a> NullView<'a> {
3382    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
3383    ///
3384    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
3385    /// and by generated sub-message decode arms with `depth - 1`.
3386    ///
3387    /// **Not part of the public API.** Named with a leading underscore to
3388    /// signal that it is for generated-code use only.
3389    #[doc(hidden)]
3390    pub fn _decode_depth(
3391        buf: &'a [u8],
3392        depth: u32,
3393    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3394        let mut view = Self::default();
3395        view._merge_into_view(buf, depth)?;
3396        ::core::result::Result::Ok(view)
3397    }
3398    /// Merge fields from `buf` into this view (proto merge semantics).
3399    ///
3400    /// Repeated fields append; singular fields last-wins; singular
3401    /// MESSAGE fields merge recursively. Used by sub-message decode
3402    /// arms when the same field appears multiple times on the wire.
3403    ///
3404    /// **Not part of the public API.**
3405    #[doc(hidden)]
3406    pub fn _merge_into_view(
3407        &mut self,
3408        buf: &'a [u8],
3409        depth: u32,
3410    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3411        let _ = depth;
3412        #[allow(unused_variables)]
3413        let view = self;
3414        let mut cur: &'a [u8] = buf;
3415        while !cur.is_empty() {
3416            let before_tag = cur;
3417            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
3418            match tag.field_number() {
3419                _ => {
3420                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
3421                    let span_len = before_tag.len() - cur.len();
3422                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
3423                }
3424            }
3425        }
3426        ::core::result::Result::Ok(())
3427    }
3428}
3429impl<'a> ::buffa::MessageView<'a> for NullView<'a> {
3430    type Owned = Null;
3431    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3432        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
3433    }
3434    fn decode_view_with_limit(
3435        buf: &'a [u8],
3436        depth: u32,
3437    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3438        Self::_decode_depth(buf, depth)
3439    }
3440    /// Convert this view to the owned message type.
3441    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
3442    fn to_owned_message(&self) -> Null {
3443        #[allow(unused_imports)]
3444        use ::buffa::alloc::string::ToString as _;
3445        Null {
3446            __buffa_unknown_fields: self
3447                .__buffa_unknown_fields
3448                .to_owned()
3449                .unwrap_or_default()
3450                .into(),
3451            ..::core::default::Default::default()
3452        }
3453    }
3454}
3455unsafe impl ::buffa::DefaultViewInstance for NullView<'static> {
3456    fn default_view_instance() -> &'static Self {
3457        static VALUE: ::buffa::__private::OnceBox<NullView<'static>> = ::buffa::__private::OnceBox::new();
3458        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3459    }
3460}
3461unsafe impl<'a> ::buffa::HasDefaultViewInstance for NullView<'a> {
3462    type Static = NullView<'static>;
3463}
3464/// Ordered list of scalar cells. Used for `List<...>` columns. Elements must
3465/// all carry the same inner kind (Int64, Float64, Boolean, or Utf8).
3466#[derive(Clone, PartialEq, Default)]
3467#[derive(::serde::Serialize, ::serde::Deserialize)]
3468#[serde(default)]
3469pub struct ListValue {
3470    /// Field 1: `elements`
3471    #[serde(
3472        rename = "elements",
3473        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
3474        deserialize_with = "::buffa::json_helpers::null_as_default"
3475    )]
3476    pub elements: ::buffa::alloc::vec::Vec<Cell>,
3477    #[serde(skip)]
3478    #[doc(hidden)]
3479    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3480    #[doc(hidden)]
3481    #[serde(skip)]
3482    pub __buffa_cached_size: ::buffa::__private::CachedSize,
3483}
3484impl ::core::fmt::Debug for ListValue {
3485    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3486        f.debug_struct("ListValue").field("elements", &self.elements).finish()
3487    }
3488}
3489impl ListValue {
3490    /// Protobuf type URL for this message, for use with `Any::pack` and
3491    /// `Any::unpack_if`.
3492    ///
3493    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3494    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.ListValue";
3495}
3496unsafe impl ::buffa::DefaultInstance for ListValue {
3497    fn default_instance() -> &'static Self {
3498        static VALUE: ::buffa::__private::OnceBox<ListValue> = ::buffa::__private::OnceBox::new();
3499        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3500    }
3501}
3502impl ::buffa::Message for ListValue {
3503    /// Returns the total encoded size in bytes.
3504    ///
3505    /// The result is a `u32`; the protobuf specification requires all
3506    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3507    /// compliant message will never overflow this type.
3508    fn compute_size(&self) -> u32 {
3509        #[allow(unused_imports)]
3510        use ::buffa::Enumeration as _;
3511        let mut size = 0u32;
3512        for v in &self.elements {
3513            let inner_size = v.compute_size();
3514            size
3515                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3516                    + inner_size;
3517        }
3518        size += self.__buffa_unknown_fields.encoded_len() as u32;
3519        self.__buffa_cached_size.set(size);
3520        size
3521    }
3522    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
3523        #[allow(unused_imports)]
3524        use ::buffa::Enumeration as _;
3525        for v in &self.elements {
3526            ::buffa::encoding::Tag::new(
3527                    1u32,
3528                    ::buffa::encoding::WireType::LengthDelimited,
3529                )
3530                .encode(buf);
3531            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
3532            v.write_to(buf);
3533        }
3534        self.__buffa_unknown_fields.write_to(buf);
3535    }
3536    fn merge_field(
3537        &mut self,
3538        tag: ::buffa::encoding::Tag,
3539        buf: &mut impl ::buffa::bytes::Buf,
3540        depth: u32,
3541    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3542        #[allow(unused_imports)]
3543        use ::buffa::bytes::Buf as _;
3544        #[allow(unused_imports)]
3545        use ::buffa::Enumeration as _;
3546        match tag.field_number() {
3547            1u32 => {
3548                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3549                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3550                        field_number: 1u32,
3551                        expected: 2u8,
3552                        actual: tag.wire_type() as u8,
3553                    });
3554                }
3555                let mut elem = ::core::default::Default::default();
3556                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
3557                self.elements.push(elem);
3558            }
3559            _ => {
3560                self.__buffa_unknown_fields
3561                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
3562            }
3563        }
3564        ::core::result::Result::Ok(())
3565    }
3566    fn cached_size(&self) -> u32 {
3567        self.__buffa_cached_size.get()
3568    }
3569    fn clear(&mut self) {
3570        self.elements.clear();
3571        self.__buffa_unknown_fields.clear();
3572        self.__buffa_cached_size.set(0);
3573    }
3574}
3575impl ::buffa::ExtensionSet for ListValue {
3576    const PROTO_FQN: &'static str = "store.sql.v1.ListValue";
3577    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3578        &self.__buffa_unknown_fields
3579    }
3580    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3581        &mut self.__buffa_unknown_fields
3582    }
3583}
3584impl ::buffa::json_helpers::ProtoElemJson for ListValue {
3585    fn serialize_proto_json<S: ::serde::Serializer>(
3586        v: &Self,
3587        s: S,
3588    ) -> ::core::result::Result<S::Ok, S::Error> {
3589        ::serde::Serialize::serialize(v, s)
3590    }
3591    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3592        d: D,
3593    ) -> ::core::result::Result<Self, D::Error> {
3594        <Self as ::serde::Deserialize>::deserialize(d)
3595    }
3596}
3597#[doc(hidden)]
3598pub const __LIST_VALUE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3599    type_url: "type.googleapis.com/store.sql.v1.ListValue",
3600    to_json: ::buffa::type_registry::any_to_json::<ListValue>,
3601    from_json: ::buffa::type_registry::any_from_json::<ListValue>,
3602    is_wkt: false,
3603};
3604/// Ordered list of scalar cells. Used for `List<...>` columns. Elements must
3605/// all carry the same inner kind (Int64, Float64, Boolean, or Utf8).
3606#[derive(Clone, Debug, Default)]
3607pub struct ListValueView<'a> {
3608    /// Field 1: `elements`
3609    pub elements: ::buffa::RepeatedView<'a, CellView<'a>>,
3610    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3611}
3612impl<'a> ListValueView<'a> {
3613    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
3614    ///
3615    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
3616    /// and by generated sub-message decode arms with `depth - 1`.
3617    ///
3618    /// **Not part of the public API.** Named with a leading underscore to
3619    /// signal that it is for generated-code use only.
3620    #[doc(hidden)]
3621    pub fn _decode_depth(
3622        buf: &'a [u8],
3623        depth: u32,
3624    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3625        let mut view = Self::default();
3626        view._merge_into_view(buf, depth)?;
3627        ::core::result::Result::Ok(view)
3628    }
3629    /// Merge fields from `buf` into this view (proto merge semantics).
3630    ///
3631    /// Repeated fields append; singular fields last-wins; singular
3632    /// MESSAGE fields merge recursively. Used by sub-message decode
3633    /// arms when the same field appears multiple times on the wire.
3634    ///
3635    /// **Not part of the public API.**
3636    #[doc(hidden)]
3637    pub fn _merge_into_view(
3638        &mut self,
3639        buf: &'a [u8],
3640        depth: u32,
3641    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3642        let _ = depth;
3643        #[allow(unused_variables)]
3644        let view = self;
3645        let mut cur: &'a [u8] = buf;
3646        while !cur.is_empty() {
3647            let before_tag = cur;
3648            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
3649            match tag.field_number() {
3650                1u32 => {
3651                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3652                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3653                            field_number: 1u32,
3654                            expected: 2u8,
3655                            actual: tag.wire_type() as u8,
3656                        });
3657                    }
3658                    if depth == 0 {
3659                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
3660                    }
3661                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
3662                    view.elements.push(CellView::_decode_depth(sub, depth - 1)?);
3663                }
3664                _ => {
3665                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
3666                    let span_len = before_tag.len() - cur.len();
3667                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
3668                }
3669            }
3670        }
3671        ::core::result::Result::Ok(())
3672    }
3673}
3674impl<'a> ::buffa::MessageView<'a> for ListValueView<'a> {
3675    type Owned = ListValue;
3676    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3677        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
3678    }
3679    fn decode_view_with_limit(
3680        buf: &'a [u8],
3681        depth: u32,
3682    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3683        Self::_decode_depth(buf, depth)
3684    }
3685    /// Convert this view to the owned message type.
3686    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
3687    fn to_owned_message(&self) -> ListValue {
3688        #[allow(unused_imports)]
3689        use ::buffa::alloc::string::ToString as _;
3690        ListValue {
3691            elements: self.elements.iter().map(|v| v.to_owned_message()).collect(),
3692            __buffa_unknown_fields: self
3693                .__buffa_unknown_fields
3694                .to_owned()
3695                .unwrap_or_default()
3696                .into(),
3697            ..::core::default::Default::default()
3698        }
3699    }
3700}
3701unsafe impl ::buffa::DefaultViewInstance for ListValueView<'static> {
3702    fn default_view_instance() -> &'static Self {
3703        static VALUE: ::buffa::__private::OnceBox<ListValueView<'static>> = ::buffa::__private::OnceBox::new();
3704        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3705    }
3706}
3707unsafe impl<'a> ::buffa::HasDefaultViewInstance for ListValueView<'a> {
3708    type Static = ListValueView<'static>;
3709}
3710/// Typed scalar for one row cell. Mirrors every column kind supported by
3711/// `KvSchema`. Servers MUST always set `kind`; clients MUST treat a missing
3712/// `kind` as a protocol error rather than as NULL.
3713#[derive(Clone, PartialEq, Default)]
3714#[derive(::serde::Serialize)]
3715#[serde(default)]
3716pub struct Cell {
3717    #[serde(flatten)]
3718    pub kind: Option<cell::Kind>,
3719    #[serde(skip)]
3720    #[doc(hidden)]
3721    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3722    #[doc(hidden)]
3723    #[serde(skip)]
3724    pub __buffa_cached_size: ::buffa::__private::CachedSize,
3725}
3726impl ::core::fmt::Debug for Cell {
3727    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3728        f.debug_struct("Cell").field("kind", &self.kind).finish()
3729    }
3730}
3731impl Cell {
3732    /// Protobuf type URL for this message, for use with `Any::pack` and
3733    /// `Any::unpack_if`.
3734    ///
3735    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3736    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Cell";
3737}
3738unsafe impl ::buffa::DefaultInstance for Cell {
3739    fn default_instance() -> &'static Self {
3740        static VALUE: ::buffa::__private::OnceBox<Cell> = ::buffa::__private::OnceBox::new();
3741        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3742    }
3743}
3744impl ::buffa::Message for Cell {
3745    /// Returns the total encoded size in bytes.
3746    ///
3747    /// The result is a `u32`; the protobuf specification requires all
3748    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3749    /// compliant message will never overflow this type.
3750    fn compute_size(&self) -> u32 {
3751        #[allow(unused_imports)]
3752        use ::buffa::Enumeration as _;
3753        let mut size = 0u32;
3754        if let ::core::option::Option::Some(ref v) = self.kind {
3755            match v {
3756                cell::Kind::NullValue(x) => {
3757                    let inner = x.compute_size();
3758                    size
3759                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3760                            + inner;
3761                }
3762                cell::Kind::Int64Value(v) => {
3763                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
3764                }
3765                cell::Kind::Uint64Value(v) => {
3766                    size += 1u32 + ::buffa::types::uint64_encoded_len(*v) as u32;
3767                }
3768                cell::Kind::Float64Value(_x) => {
3769                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
3770                }
3771                cell::Kind::BooleanValue(_x) => {
3772                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
3773                }
3774                cell::Kind::Utf8Value(x) => {
3775                    size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
3776                }
3777                cell::Kind::FixedSizeBinaryValue(x) => {
3778                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
3779                }
3780                cell::Kind::Date32Value(v) => {
3781                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
3782                }
3783                cell::Kind::Date64Value(v) => {
3784                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
3785                }
3786                cell::Kind::TimestampValue(v) => {
3787                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
3788                }
3789                cell::Kind::Decimal128Value(x) => {
3790                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
3791                }
3792                cell::Kind::Decimal256Value(x) => {
3793                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
3794                }
3795                cell::Kind::ListValue(x) => {
3796                    let inner = x.compute_size();
3797                    size
3798                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
3799                            + inner;
3800                }
3801            }
3802        }
3803        size += self.__buffa_unknown_fields.encoded_len() as u32;
3804        self.__buffa_cached_size.set(size);
3805        size
3806    }
3807    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
3808        #[allow(unused_imports)]
3809        use ::buffa::Enumeration as _;
3810        if let ::core::option::Option::Some(ref v) = self.kind {
3811            match v {
3812                cell::Kind::NullValue(x) => {
3813                    ::buffa::encoding::Tag::new(
3814                            1u32,
3815                            ::buffa::encoding::WireType::LengthDelimited,
3816                        )
3817                        .encode(buf);
3818                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
3819                    x.write_to(buf);
3820                }
3821                cell::Kind::Int64Value(x) => {
3822                    ::buffa::encoding::Tag::new(
3823                            2u32,
3824                            ::buffa::encoding::WireType::Varint,
3825                        )
3826                        .encode(buf);
3827                    ::buffa::types::encode_int64(*x, buf);
3828                }
3829                cell::Kind::Uint64Value(x) => {
3830                    ::buffa::encoding::Tag::new(
3831                            3u32,
3832                            ::buffa::encoding::WireType::Varint,
3833                        )
3834                        .encode(buf);
3835                    ::buffa::types::encode_uint64(*x, buf);
3836                }
3837                cell::Kind::Float64Value(x) => {
3838                    ::buffa::encoding::Tag::new(
3839                            4u32,
3840                            ::buffa::encoding::WireType::Fixed64,
3841                        )
3842                        .encode(buf);
3843                    ::buffa::types::encode_double(*x, buf);
3844                }
3845                cell::Kind::BooleanValue(x) => {
3846                    ::buffa::encoding::Tag::new(
3847                            5u32,
3848                            ::buffa::encoding::WireType::Varint,
3849                        )
3850                        .encode(buf);
3851                    ::buffa::types::encode_bool(*x, buf);
3852                }
3853                cell::Kind::Utf8Value(x) => {
3854                    ::buffa::encoding::Tag::new(
3855                            6u32,
3856                            ::buffa::encoding::WireType::LengthDelimited,
3857                        )
3858                        .encode(buf);
3859                    ::buffa::types::encode_string(x, buf);
3860                }
3861                cell::Kind::FixedSizeBinaryValue(x) => {
3862                    ::buffa::encoding::Tag::new(
3863                            7u32,
3864                            ::buffa::encoding::WireType::LengthDelimited,
3865                        )
3866                        .encode(buf);
3867                    ::buffa::types::encode_bytes(x, buf);
3868                }
3869                cell::Kind::Date32Value(x) => {
3870                    ::buffa::encoding::Tag::new(
3871                            8u32,
3872                            ::buffa::encoding::WireType::Varint,
3873                        )
3874                        .encode(buf);
3875                    ::buffa::types::encode_int32(*x, buf);
3876                }
3877                cell::Kind::Date64Value(x) => {
3878                    ::buffa::encoding::Tag::new(
3879                            9u32,
3880                            ::buffa::encoding::WireType::Varint,
3881                        )
3882                        .encode(buf);
3883                    ::buffa::types::encode_int64(*x, buf);
3884                }
3885                cell::Kind::TimestampValue(x) => {
3886                    ::buffa::encoding::Tag::new(
3887                            10u32,
3888                            ::buffa::encoding::WireType::Varint,
3889                        )
3890                        .encode(buf);
3891                    ::buffa::types::encode_int64(*x, buf);
3892                }
3893                cell::Kind::Decimal128Value(x) => {
3894                    ::buffa::encoding::Tag::new(
3895                            11u32,
3896                            ::buffa::encoding::WireType::LengthDelimited,
3897                        )
3898                        .encode(buf);
3899                    ::buffa::types::encode_bytes(x, buf);
3900                }
3901                cell::Kind::Decimal256Value(x) => {
3902                    ::buffa::encoding::Tag::new(
3903                            12u32,
3904                            ::buffa::encoding::WireType::LengthDelimited,
3905                        )
3906                        .encode(buf);
3907                    ::buffa::types::encode_bytes(x, buf);
3908                }
3909                cell::Kind::ListValue(x) => {
3910                    ::buffa::encoding::Tag::new(
3911                            13u32,
3912                            ::buffa::encoding::WireType::LengthDelimited,
3913                        )
3914                        .encode(buf);
3915                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
3916                    x.write_to(buf);
3917                }
3918            }
3919        }
3920        self.__buffa_unknown_fields.write_to(buf);
3921    }
3922    fn merge_field(
3923        &mut self,
3924        tag: ::buffa::encoding::Tag,
3925        buf: &mut impl ::buffa::bytes::Buf,
3926        depth: u32,
3927    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3928        #[allow(unused_imports)]
3929        use ::buffa::bytes::Buf as _;
3930        #[allow(unused_imports)]
3931        use ::buffa::Enumeration as _;
3932        match tag.field_number() {
3933            1u32 => {
3934                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3935                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3936                        field_number: 1u32,
3937                        expected: 2u8,
3938                        actual: tag.wire_type() as u8,
3939                    });
3940                }
3941                if let ::core::option::Option::Some(
3942                    cell::Kind::NullValue(ref mut existing),
3943                ) = self.kind
3944                {
3945                    ::buffa::Message::merge_length_delimited(
3946                        &mut **existing,
3947                        buf,
3948                        depth,
3949                    )?;
3950                } else {
3951                    let mut val = ::core::default::Default::default();
3952                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
3953                    self.kind = ::core::option::Option::Some(
3954                        cell::Kind::NullValue(::buffa::alloc::boxed::Box::new(val)),
3955                    );
3956                }
3957            }
3958            2u32 => {
3959                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
3960                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3961                        field_number: 2u32,
3962                        expected: 0u8,
3963                        actual: tag.wire_type() as u8,
3964                    });
3965                }
3966                self.kind = ::core::option::Option::Some(
3967                    cell::Kind::Int64Value(::buffa::types::decode_int64(buf)?),
3968                );
3969            }
3970            3u32 => {
3971                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
3972                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3973                        field_number: 3u32,
3974                        expected: 0u8,
3975                        actual: tag.wire_type() as u8,
3976                    });
3977                }
3978                self.kind = ::core::option::Option::Some(
3979                    cell::Kind::Uint64Value(::buffa::types::decode_uint64(buf)?),
3980                );
3981            }
3982            4u32 => {
3983                if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
3984                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3985                        field_number: 4u32,
3986                        expected: 1u8,
3987                        actual: tag.wire_type() as u8,
3988                    });
3989                }
3990                self.kind = ::core::option::Option::Some(
3991                    cell::Kind::Float64Value(::buffa::types::decode_double(buf)?),
3992                );
3993            }
3994            5u32 => {
3995                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
3996                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3997                        field_number: 5u32,
3998                        expected: 0u8,
3999                        actual: tag.wire_type() as u8,
4000                    });
4001                }
4002                self.kind = ::core::option::Option::Some(
4003                    cell::Kind::BooleanValue(::buffa::types::decode_bool(buf)?),
4004                );
4005            }
4006            6u32 => {
4007                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4008                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4009                        field_number: 6u32,
4010                        expected: 2u8,
4011                        actual: tag.wire_type() as u8,
4012                    });
4013                }
4014                self.kind = ::core::option::Option::Some(
4015                    cell::Kind::Utf8Value(::buffa::types::decode_string(buf)?),
4016                );
4017            }
4018            7u32 => {
4019                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4020                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4021                        field_number: 7u32,
4022                        expected: 2u8,
4023                        actual: tag.wire_type() as u8,
4024                    });
4025                }
4026                self.kind = ::core::option::Option::Some(
4027                    cell::Kind::FixedSizeBinaryValue(::buffa::types::decode_bytes(buf)?),
4028                );
4029            }
4030            8u32 => {
4031                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4032                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4033                        field_number: 8u32,
4034                        expected: 0u8,
4035                        actual: tag.wire_type() as u8,
4036                    });
4037                }
4038                self.kind = ::core::option::Option::Some(
4039                    cell::Kind::Date32Value(::buffa::types::decode_int32(buf)?),
4040                );
4041            }
4042            9u32 => {
4043                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4044                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4045                        field_number: 9u32,
4046                        expected: 0u8,
4047                        actual: tag.wire_type() as u8,
4048                    });
4049                }
4050                self.kind = ::core::option::Option::Some(
4051                    cell::Kind::Date64Value(::buffa::types::decode_int64(buf)?),
4052                );
4053            }
4054            10u32 => {
4055                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4056                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4057                        field_number: 10u32,
4058                        expected: 0u8,
4059                        actual: tag.wire_type() as u8,
4060                    });
4061                }
4062                self.kind = ::core::option::Option::Some(
4063                    cell::Kind::TimestampValue(::buffa::types::decode_int64(buf)?),
4064                );
4065            }
4066            11u32 => {
4067                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4068                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4069                        field_number: 11u32,
4070                        expected: 2u8,
4071                        actual: tag.wire_type() as u8,
4072                    });
4073                }
4074                self.kind = ::core::option::Option::Some(
4075                    cell::Kind::Decimal128Value(::buffa::types::decode_bytes(buf)?),
4076                );
4077            }
4078            12u32 => {
4079                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4080                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4081                        field_number: 12u32,
4082                        expected: 2u8,
4083                        actual: tag.wire_type() as u8,
4084                    });
4085                }
4086                self.kind = ::core::option::Option::Some(
4087                    cell::Kind::Decimal256Value(::buffa::types::decode_bytes(buf)?),
4088                );
4089            }
4090            13u32 => {
4091                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4092                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4093                        field_number: 13u32,
4094                        expected: 2u8,
4095                        actual: tag.wire_type() as u8,
4096                    });
4097                }
4098                if let ::core::option::Option::Some(
4099                    cell::Kind::ListValue(ref mut existing),
4100                ) = self.kind
4101                {
4102                    ::buffa::Message::merge_length_delimited(
4103                        &mut **existing,
4104                        buf,
4105                        depth,
4106                    )?;
4107                } else {
4108                    let mut val = ::core::default::Default::default();
4109                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
4110                    self.kind = ::core::option::Option::Some(
4111                        cell::Kind::ListValue(::buffa::alloc::boxed::Box::new(val)),
4112                    );
4113                }
4114            }
4115            _ => {
4116                self.__buffa_unknown_fields
4117                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
4118            }
4119        }
4120        ::core::result::Result::Ok(())
4121    }
4122    fn cached_size(&self) -> u32 {
4123        self.__buffa_cached_size.get()
4124    }
4125    fn clear(&mut self) {
4126        self.kind = ::core::option::Option::None;
4127        self.__buffa_unknown_fields.clear();
4128        self.__buffa_cached_size.set(0);
4129    }
4130}
4131impl ::buffa::ExtensionSet for Cell {
4132    const PROTO_FQN: &'static str = "store.sql.v1.Cell";
4133    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4134        &self.__buffa_unknown_fields
4135    }
4136    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4137        &mut self.__buffa_unknown_fields
4138    }
4139}
4140impl<'de> serde::Deserialize<'de> for Cell {
4141    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
4142        struct _V;
4143        impl<'de> serde::de::Visitor<'de> for _V {
4144            type Value = Cell;
4145            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
4146                f.write_str("struct Cell")
4147            }
4148            #[allow(clippy::field_reassign_with_default)]
4149            fn visit_map<A: serde::de::MapAccess<'de>>(
4150                self,
4151                mut map: A,
4152            ) -> Result<Cell, A::Error> {
4153                let mut __oneof_kind: Option<cell::Kind> = None;
4154                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
4155                    match key.as_str() {
4156                        "nullValue" | "null_value" => {
4157                            let v: Option<Null> = map
4158                                .next_value_seed(
4159                                    ::buffa::json_helpers::NullableDeserializeSeed(
4160                                        ::buffa::json_helpers::DefaultDeserializeSeed::<Null>::new(),
4161                                    ),
4162                                )?;
4163                            if let Some(v) = v {
4164                                if __oneof_kind.is_some() {
4165                                    return Err(
4166                                        serde::de::Error::custom(
4167                                            "multiple oneof fields set for 'kind'",
4168                                        ),
4169                                    );
4170                                }
4171                                __oneof_kind = Some(
4172                                    cell::Kind::NullValue(::buffa::alloc::boxed::Box::new(v)),
4173                                );
4174                            }
4175                        }
4176                        "int64Value" | "int64_value" => {
4177                            struct _DeserSeed;
4178                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4179                                type Value = i64;
4180                                fn deserialize<D: serde::Deserializer<'de>>(
4181                                    self,
4182                                    d: D,
4183                                ) -> ::core::result::Result<i64, D::Error> {
4184                                    ::buffa::json_helpers::int64::deserialize(d)
4185                                }
4186                            }
4187                            let v: Option<i64> = map
4188                                .next_value_seed(
4189                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4190                                )?;
4191                            if let Some(v) = v {
4192                                if __oneof_kind.is_some() {
4193                                    return Err(
4194                                        serde::de::Error::custom(
4195                                            "multiple oneof fields set for 'kind'",
4196                                        ),
4197                                    );
4198                                }
4199                                __oneof_kind = Some(cell::Kind::Int64Value(v));
4200                            }
4201                        }
4202                        "uint64Value" | "uint64_value" => {
4203                            struct _DeserSeed;
4204                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4205                                type Value = u64;
4206                                fn deserialize<D: serde::Deserializer<'de>>(
4207                                    self,
4208                                    d: D,
4209                                ) -> ::core::result::Result<u64, D::Error> {
4210                                    ::buffa::json_helpers::uint64::deserialize(d)
4211                                }
4212                            }
4213                            let v: Option<u64> = map
4214                                .next_value_seed(
4215                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4216                                )?;
4217                            if let Some(v) = v {
4218                                if __oneof_kind.is_some() {
4219                                    return Err(
4220                                        serde::de::Error::custom(
4221                                            "multiple oneof fields set for 'kind'",
4222                                        ),
4223                                    );
4224                                }
4225                                __oneof_kind = Some(cell::Kind::Uint64Value(v));
4226                            }
4227                        }
4228                        "float64Value" | "float64_value" => {
4229                            struct _DeserSeed;
4230                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4231                                type Value = f64;
4232                                fn deserialize<D: serde::Deserializer<'de>>(
4233                                    self,
4234                                    d: D,
4235                                ) -> ::core::result::Result<f64, D::Error> {
4236                                    ::buffa::json_helpers::double::deserialize(d)
4237                                }
4238                            }
4239                            let v: Option<f64> = map
4240                                .next_value_seed(
4241                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4242                                )?;
4243                            if let Some(v) = v {
4244                                if __oneof_kind.is_some() {
4245                                    return Err(
4246                                        serde::de::Error::custom(
4247                                            "multiple oneof fields set for 'kind'",
4248                                        ),
4249                                    );
4250                                }
4251                                __oneof_kind = Some(cell::Kind::Float64Value(v));
4252                            }
4253                        }
4254                        "booleanValue" | "boolean_value" => {
4255                            let v: Option<bool> = map
4256                                .next_value_seed(
4257                                    ::buffa::json_helpers::NullableDeserializeSeed(
4258                                        ::buffa::json_helpers::DefaultDeserializeSeed::<bool>::new(),
4259                                    ),
4260                                )?;
4261                            if let Some(v) = v {
4262                                if __oneof_kind.is_some() {
4263                                    return Err(
4264                                        serde::de::Error::custom(
4265                                            "multiple oneof fields set for 'kind'",
4266                                        ),
4267                                    );
4268                                }
4269                                __oneof_kind = Some(cell::Kind::BooleanValue(v));
4270                            }
4271                        }
4272                        "utf8Value" | "utf8_value" => {
4273                            let v: Option<::buffa::alloc::string::String> = map
4274                                .next_value_seed(
4275                                    ::buffa::json_helpers::NullableDeserializeSeed(
4276                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
4277                                            ::buffa::alloc::string::String,
4278                                        >::new(),
4279                                    ),
4280                                )?;
4281                            if let Some(v) = v {
4282                                if __oneof_kind.is_some() {
4283                                    return Err(
4284                                        serde::de::Error::custom(
4285                                            "multiple oneof fields set for 'kind'",
4286                                        ),
4287                                    );
4288                                }
4289                                __oneof_kind = Some(cell::Kind::Utf8Value(v));
4290                            }
4291                        }
4292                        "fixedSizeBinaryValue" | "fixed_size_binary_value" => {
4293                            struct _DeserSeed;
4294                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4295                                type Value = ::buffa::alloc::vec::Vec<u8>;
4296                                fn deserialize<D: serde::Deserializer<'de>>(
4297                                    self,
4298                                    d: D,
4299                                ) -> ::core::result::Result<
4300                                    ::buffa::alloc::vec::Vec<u8>,
4301                                    D::Error,
4302                                > {
4303                                    ::buffa::json_helpers::bytes::deserialize(d)
4304                                }
4305                            }
4306                            let v: Option<::buffa::alloc::vec::Vec<u8>> = map
4307                                .next_value_seed(
4308                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4309                                )?;
4310                            if let Some(v) = v {
4311                                if __oneof_kind.is_some() {
4312                                    return Err(
4313                                        serde::de::Error::custom(
4314                                            "multiple oneof fields set for 'kind'",
4315                                        ),
4316                                    );
4317                                }
4318                                __oneof_kind = Some(cell::Kind::FixedSizeBinaryValue(v));
4319                            }
4320                        }
4321                        "date32Value" | "date32_value" => {
4322                            struct _DeserSeed;
4323                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4324                                type Value = i32;
4325                                fn deserialize<D: serde::Deserializer<'de>>(
4326                                    self,
4327                                    d: D,
4328                                ) -> ::core::result::Result<i32, D::Error> {
4329                                    ::buffa::json_helpers::int32::deserialize(d)
4330                                }
4331                            }
4332                            let v: Option<i32> = map
4333                                .next_value_seed(
4334                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4335                                )?;
4336                            if let Some(v) = v {
4337                                if __oneof_kind.is_some() {
4338                                    return Err(
4339                                        serde::de::Error::custom(
4340                                            "multiple oneof fields set for 'kind'",
4341                                        ),
4342                                    );
4343                                }
4344                                __oneof_kind = Some(cell::Kind::Date32Value(v));
4345                            }
4346                        }
4347                        "date64Value" | "date64_value" => {
4348                            struct _DeserSeed;
4349                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4350                                type Value = i64;
4351                                fn deserialize<D: serde::Deserializer<'de>>(
4352                                    self,
4353                                    d: D,
4354                                ) -> ::core::result::Result<i64, D::Error> {
4355                                    ::buffa::json_helpers::int64::deserialize(d)
4356                                }
4357                            }
4358                            let v: Option<i64> = map
4359                                .next_value_seed(
4360                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4361                                )?;
4362                            if let Some(v) = v {
4363                                if __oneof_kind.is_some() {
4364                                    return Err(
4365                                        serde::de::Error::custom(
4366                                            "multiple oneof fields set for 'kind'",
4367                                        ),
4368                                    );
4369                                }
4370                                __oneof_kind = Some(cell::Kind::Date64Value(v));
4371                            }
4372                        }
4373                        "timestampValue" | "timestamp_value" => {
4374                            struct _DeserSeed;
4375                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4376                                type Value = i64;
4377                                fn deserialize<D: serde::Deserializer<'de>>(
4378                                    self,
4379                                    d: D,
4380                                ) -> ::core::result::Result<i64, D::Error> {
4381                                    ::buffa::json_helpers::int64::deserialize(d)
4382                                }
4383                            }
4384                            let v: Option<i64> = map
4385                                .next_value_seed(
4386                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4387                                )?;
4388                            if let Some(v) = v {
4389                                if __oneof_kind.is_some() {
4390                                    return Err(
4391                                        serde::de::Error::custom(
4392                                            "multiple oneof fields set for 'kind'",
4393                                        ),
4394                                    );
4395                                }
4396                                __oneof_kind = Some(cell::Kind::TimestampValue(v));
4397                            }
4398                        }
4399                        "decimal128Value" | "decimal128_value" => {
4400                            struct _DeserSeed;
4401                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4402                                type Value = ::buffa::alloc::vec::Vec<u8>;
4403                                fn deserialize<D: serde::Deserializer<'de>>(
4404                                    self,
4405                                    d: D,
4406                                ) -> ::core::result::Result<
4407                                    ::buffa::alloc::vec::Vec<u8>,
4408                                    D::Error,
4409                                > {
4410                                    ::buffa::json_helpers::bytes::deserialize(d)
4411                                }
4412                            }
4413                            let v: Option<::buffa::alloc::vec::Vec<u8>> = map
4414                                .next_value_seed(
4415                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4416                                )?;
4417                            if let Some(v) = v {
4418                                if __oneof_kind.is_some() {
4419                                    return Err(
4420                                        serde::de::Error::custom(
4421                                            "multiple oneof fields set for 'kind'",
4422                                        ),
4423                                    );
4424                                }
4425                                __oneof_kind = Some(cell::Kind::Decimal128Value(v));
4426                            }
4427                        }
4428                        "decimal256Value" | "decimal256_value" => {
4429                            struct _DeserSeed;
4430                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
4431                                type Value = ::buffa::alloc::vec::Vec<u8>;
4432                                fn deserialize<D: serde::Deserializer<'de>>(
4433                                    self,
4434                                    d: D,
4435                                ) -> ::core::result::Result<
4436                                    ::buffa::alloc::vec::Vec<u8>,
4437                                    D::Error,
4438                                > {
4439                                    ::buffa::json_helpers::bytes::deserialize(d)
4440                                }
4441                            }
4442                            let v: Option<::buffa::alloc::vec::Vec<u8>> = map
4443                                .next_value_seed(
4444                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
4445                                )?;
4446                            if let Some(v) = v {
4447                                if __oneof_kind.is_some() {
4448                                    return Err(
4449                                        serde::de::Error::custom(
4450                                            "multiple oneof fields set for 'kind'",
4451                                        ),
4452                                    );
4453                                }
4454                                __oneof_kind = Some(cell::Kind::Decimal256Value(v));
4455                            }
4456                        }
4457                        "listValue" | "list_value" => {
4458                            let v: Option<ListValue> = map
4459                                .next_value_seed(
4460                                    ::buffa::json_helpers::NullableDeserializeSeed(
4461                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
4462                                            ListValue,
4463                                        >::new(),
4464                                    ),
4465                                )?;
4466                            if let Some(v) = v {
4467                                if __oneof_kind.is_some() {
4468                                    return Err(
4469                                        serde::de::Error::custom(
4470                                            "multiple oneof fields set for 'kind'",
4471                                        ),
4472                                    );
4473                                }
4474                                __oneof_kind = Some(
4475                                    cell::Kind::ListValue(::buffa::alloc::boxed::Box::new(v)),
4476                                );
4477                            }
4478                        }
4479                        _ => {
4480                            map.next_value::<serde::de::IgnoredAny>()?;
4481                        }
4482                    }
4483                }
4484                let mut __r = <Cell as ::core::default::Default>::default();
4485                __r.kind = __oneof_kind;
4486                Ok(__r)
4487            }
4488        }
4489        d.deserialize_map(_V)
4490    }
4491}
4492impl ::buffa::json_helpers::ProtoElemJson for Cell {
4493    fn serialize_proto_json<S: ::serde::Serializer>(
4494        v: &Self,
4495        s: S,
4496    ) -> ::core::result::Result<S::Ok, S::Error> {
4497        ::serde::Serialize::serialize(v, s)
4498    }
4499    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4500        d: D,
4501    ) -> ::core::result::Result<Self, D::Error> {
4502        <Self as ::serde::Deserialize>::deserialize(d)
4503    }
4504}
4505#[doc(hidden)]
4506pub const __CELL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4507    type_url: "type.googleapis.com/store.sql.v1.Cell",
4508    to_json: ::buffa::type_registry::any_to_json::<Cell>,
4509    from_json: ::buffa::type_registry::any_from_json::<Cell>,
4510    is_wkt: false,
4511};
4512/// Typed scalar for one row cell. Mirrors every column kind supported by
4513/// `KvSchema`. Servers MUST always set `kind`; clients MUST treat a missing
4514/// `kind` as a protocol error rather than as NULL.
4515#[derive(Clone, Debug, Default)]
4516pub struct CellView<'a> {
4517    pub kind: ::core::option::Option<cell::KindView<'a>>,
4518    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
4519}
4520impl<'a> CellView<'a> {
4521    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
4522    ///
4523    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
4524    /// and by generated sub-message decode arms with `depth - 1`.
4525    ///
4526    /// **Not part of the public API.** Named with a leading underscore to
4527    /// signal that it is for generated-code use only.
4528    #[doc(hidden)]
4529    pub fn _decode_depth(
4530        buf: &'a [u8],
4531        depth: u32,
4532    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4533        let mut view = Self::default();
4534        view._merge_into_view(buf, depth)?;
4535        ::core::result::Result::Ok(view)
4536    }
4537    /// Merge fields from `buf` into this view (proto merge semantics).
4538    ///
4539    /// Repeated fields append; singular fields last-wins; singular
4540    /// MESSAGE fields merge recursively. Used by sub-message decode
4541    /// arms when the same field appears multiple times on the wire.
4542    ///
4543    /// **Not part of the public API.**
4544    #[doc(hidden)]
4545    pub fn _merge_into_view(
4546        &mut self,
4547        buf: &'a [u8],
4548        depth: u32,
4549    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4550        let _ = depth;
4551        #[allow(unused_variables)]
4552        let view = self;
4553        let mut cur: &'a [u8] = buf;
4554        while !cur.is_empty() {
4555            let before_tag = cur;
4556            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
4557            match tag.field_number() {
4558                1u32 => {
4559                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4560                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4561                            field_number: 1u32,
4562                            expected: 2u8,
4563                            actual: tag.wire_type() as u8,
4564                        });
4565                    }
4566                    if depth == 0 {
4567                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
4568                    }
4569                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
4570                    if let Some(cell::KindView::NullValue(ref mut existing)) = view.kind
4571                    {
4572                        existing._merge_into_view(sub, depth - 1)?;
4573                    } else {
4574                        view.kind = Some(
4575                            cell::KindView::NullValue(
4576                                ::buffa::alloc::boxed::Box::new(
4577                                    NullView::_decode_depth(sub, depth - 1)?,
4578                                ),
4579                            ),
4580                        );
4581                    }
4582                }
4583                2u32 => {
4584                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4585                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4586                            field_number: 2u32,
4587                            expected: 0u8,
4588                            actual: tag.wire_type() as u8,
4589                        });
4590                    }
4591                    view.kind = Some(
4592                        cell::KindView::Int64Value(
4593                            ::buffa::types::decode_int64(&mut cur)?,
4594                        ),
4595                    );
4596                }
4597                3u32 => {
4598                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4599                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4600                            field_number: 3u32,
4601                            expected: 0u8,
4602                            actual: tag.wire_type() as u8,
4603                        });
4604                    }
4605                    view.kind = Some(
4606                        cell::KindView::Uint64Value(
4607                            ::buffa::types::decode_uint64(&mut cur)?,
4608                        ),
4609                    );
4610                }
4611                4u32 => {
4612                    if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
4613                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4614                            field_number: 4u32,
4615                            expected: 1u8,
4616                            actual: tag.wire_type() as u8,
4617                        });
4618                    }
4619                    view.kind = Some(
4620                        cell::KindView::Float64Value(
4621                            ::buffa::types::decode_double(&mut cur)?,
4622                        ),
4623                    );
4624                }
4625                5u32 => {
4626                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4627                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4628                            field_number: 5u32,
4629                            expected: 0u8,
4630                            actual: tag.wire_type() as u8,
4631                        });
4632                    }
4633                    view.kind = Some(
4634                        cell::KindView::BooleanValue(
4635                            ::buffa::types::decode_bool(&mut cur)?,
4636                        ),
4637                    );
4638                }
4639                6u32 => {
4640                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4641                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4642                            field_number: 6u32,
4643                            expected: 2u8,
4644                            actual: tag.wire_type() as u8,
4645                        });
4646                    }
4647                    view.kind = Some(
4648                        cell::KindView::Utf8Value(::buffa::types::borrow_str(&mut cur)?),
4649                    );
4650                }
4651                7u32 => {
4652                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4653                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4654                            field_number: 7u32,
4655                            expected: 2u8,
4656                            actual: tag.wire_type() as u8,
4657                        });
4658                    }
4659                    view.kind = Some(
4660                        cell::KindView::FixedSizeBinaryValue(
4661                            ::buffa::types::borrow_bytes(&mut cur)?,
4662                        ),
4663                    );
4664                }
4665                8u32 => {
4666                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4667                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4668                            field_number: 8u32,
4669                            expected: 0u8,
4670                            actual: tag.wire_type() as u8,
4671                        });
4672                    }
4673                    view.kind = Some(
4674                        cell::KindView::Date32Value(
4675                            ::buffa::types::decode_int32(&mut cur)?,
4676                        ),
4677                    );
4678                }
4679                9u32 => {
4680                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4681                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4682                            field_number: 9u32,
4683                            expected: 0u8,
4684                            actual: tag.wire_type() as u8,
4685                        });
4686                    }
4687                    view.kind = Some(
4688                        cell::KindView::Date64Value(
4689                            ::buffa::types::decode_int64(&mut cur)?,
4690                        ),
4691                    );
4692                }
4693                10u32 => {
4694                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4695                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4696                            field_number: 10u32,
4697                            expected: 0u8,
4698                            actual: tag.wire_type() as u8,
4699                        });
4700                    }
4701                    view.kind = Some(
4702                        cell::KindView::TimestampValue(
4703                            ::buffa::types::decode_int64(&mut cur)?,
4704                        ),
4705                    );
4706                }
4707                11u32 => {
4708                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4709                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4710                            field_number: 11u32,
4711                            expected: 2u8,
4712                            actual: tag.wire_type() as u8,
4713                        });
4714                    }
4715                    view.kind = Some(
4716                        cell::KindView::Decimal128Value(
4717                            ::buffa::types::borrow_bytes(&mut cur)?,
4718                        ),
4719                    );
4720                }
4721                12u32 => {
4722                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4723                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4724                            field_number: 12u32,
4725                            expected: 2u8,
4726                            actual: tag.wire_type() as u8,
4727                        });
4728                    }
4729                    view.kind = Some(
4730                        cell::KindView::Decimal256Value(
4731                            ::buffa::types::borrow_bytes(&mut cur)?,
4732                        ),
4733                    );
4734                }
4735                13u32 => {
4736                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4737                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4738                            field_number: 13u32,
4739                            expected: 2u8,
4740                            actual: tag.wire_type() as u8,
4741                        });
4742                    }
4743                    if depth == 0 {
4744                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
4745                    }
4746                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
4747                    if let Some(cell::KindView::ListValue(ref mut existing)) = view.kind
4748                    {
4749                        existing._merge_into_view(sub, depth - 1)?;
4750                    } else {
4751                        view.kind = Some(
4752                            cell::KindView::ListValue(
4753                                ::buffa::alloc::boxed::Box::new(
4754                                    ListValueView::_decode_depth(sub, depth - 1)?,
4755                                ),
4756                            ),
4757                        );
4758                    }
4759                }
4760                _ => {
4761                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
4762                    let span_len = before_tag.len() - cur.len();
4763                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
4764                }
4765            }
4766        }
4767        ::core::result::Result::Ok(())
4768    }
4769}
4770impl<'a> ::buffa::MessageView<'a> for CellView<'a> {
4771    type Owned = Cell;
4772    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4773        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
4774    }
4775    fn decode_view_with_limit(
4776        buf: &'a [u8],
4777        depth: u32,
4778    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4779        Self::_decode_depth(buf, depth)
4780    }
4781    /// Convert this view to the owned message type.
4782    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
4783    fn to_owned_message(&self) -> Cell {
4784        #[allow(unused_imports)]
4785        use ::buffa::alloc::string::ToString as _;
4786        Cell {
4787            kind: self
4788                .kind
4789                .as_ref()
4790                .map(|v| match v {
4791                    cell::KindView::NullValue(v) => {
4792                        cell::Kind::NullValue(
4793                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
4794                        )
4795                    }
4796                    cell::KindView::Int64Value(v) => cell::Kind::Int64Value(*v),
4797                    cell::KindView::Uint64Value(v) => cell::Kind::Uint64Value(*v),
4798                    cell::KindView::Float64Value(v) => cell::Kind::Float64Value(*v),
4799                    cell::KindView::BooleanValue(v) => cell::Kind::BooleanValue(*v),
4800                    cell::KindView::Utf8Value(v) => cell::Kind::Utf8Value(v.to_string()),
4801                    cell::KindView::FixedSizeBinaryValue(v) => {
4802                        cell::Kind::FixedSizeBinaryValue((v).to_vec())
4803                    }
4804                    cell::KindView::Date32Value(v) => cell::Kind::Date32Value(*v),
4805                    cell::KindView::Date64Value(v) => cell::Kind::Date64Value(*v),
4806                    cell::KindView::TimestampValue(v) => cell::Kind::TimestampValue(*v),
4807                    cell::KindView::Decimal128Value(v) => {
4808                        cell::Kind::Decimal128Value((v).to_vec())
4809                    }
4810                    cell::KindView::Decimal256Value(v) => {
4811                        cell::Kind::Decimal256Value((v).to_vec())
4812                    }
4813                    cell::KindView::ListValue(v) => {
4814                        cell::Kind::ListValue(
4815                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
4816                        )
4817                    }
4818                }),
4819            __buffa_unknown_fields: self
4820                .__buffa_unknown_fields
4821                .to_owned()
4822                .unwrap_or_default()
4823                .into(),
4824            ..::core::default::Default::default()
4825        }
4826    }
4827}
4828unsafe impl ::buffa::DefaultViewInstance for CellView<'static> {
4829    fn default_view_instance() -> &'static Self {
4830        static VALUE: ::buffa::__private::OnceBox<CellView<'static>> = ::buffa::__private::OnceBox::new();
4831        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
4832    }
4833}
4834unsafe impl<'a> ::buffa::HasDefaultViewInstance for CellView<'a> {
4835    type Static = CellView<'static>;
4836}
4837pub mod cell {
4838    #[allow(unused_imports)]
4839    use super::*;
4840    #[derive(Clone, PartialEq, Debug)]
4841    pub enum Kind {
4842        NullValue(::buffa::alloc::boxed::Box<super::Null>),
4843        Int64Value(i64),
4844        Uint64Value(u64),
4845        Float64Value(f64),
4846        BooleanValue(bool),
4847        Utf8Value(::buffa::alloc::string::String),
4848        FixedSizeBinaryValue(::buffa::alloc::vec::Vec<u8>),
4849        Date32Value(i32),
4850        Date64Value(i64),
4851        TimestampValue(i64),
4852        Decimal128Value(::buffa::alloc::vec::Vec<u8>),
4853        Decimal256Value(::buffa::alloc::vec::Vec<u8>),
4854        ListValue(::buffa::alloc::boxed::Box<super::ListValue>),
4855    }
4856    impl ::buffa::Oneof for Kind {}
4857    impl From<super::Null> for Kind {
4858        fn from(v: super::Null) -> Self {
4859            Self::NullValue(::buffa::alloc::boxed::Box::new(v))
4860        }
4861    }
4862    impl From<super::Null> for ::core::option::Option<Kind> {
4863        fn from(v: super::Null) -> Self {
4864            Self::Some(Kind::from(v))
4865        }
4866    }
4867    impl From<super::ListValue> for Kind {
4868        fn from(v: super::ListValue) -> Self {
4869            Self::ListValue(::buffa::alloc::boxed::Box::new(v))
4870        }
4871    }
4872    impl From<super::ListValue> for ::core::option::Option<Kind> {
4873        fn from(v: super::ListValue) -> Self {
4874            Self::Some(Kind::from(v))
4875        }
4876    }
4877    impl serde::Serialize for Kind {
4878        fn serialize<S: serde::Serializer>(
4879            &self,
4880            s: S,
4881        ) -> ::core::result::Result<S::Ok, S::Error> {
4882            use serde::ser::SerializeMap;
4883            let mut map = s.serialize_map(Some(1))?;
4884            match self {
4885                Kind::NullValue(v) => {
4886                    map.serialize_entry("nullValue", v)?;
4887                }
4888                Kind::Int64Value(v) => {
4889                    struct _W<'a>(&'a i64);
4890                    impl serde::Serialize for _W<'_> {
4891                        fn serialize<S2: serde::Serializer>(
4892                            &self,
4893                            s: S2,
4894                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4895                            ::buffa::json_helpers::int64::serialize(self.0, s)
4896                        }
4897                    }
4898                    map.serialize_entry("int64Value", &_W(v))?;
4899                }
4900                Kind::Uint64Value(v) => {
4901                    struct _W<'a>(&'a u64);
4902                    impl serde::Serialize for _W<'_> {
4903                        fn serialize<S2: serde::Serializer>(
4904                            &self,
4905                            s: S2,
4906                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4907                            ::buffa::json_helpers::uint64::serialize(self.0, s)
4908                        }
4909                    }
4910                    map.serialize_entry("uint64Value", &_W(v))?;
4911                }
4912                Kind::Float64Value(v) => {
4913                    struct _W<'a>(&'a f64);
4914                    impl serde::Serialize for _W<'_> {
4915                        fn serialize<S2: serde::Serializer>(
4916                            &self,
4917                            s: S2,
4918                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4919                            ::buffa::json_helpers::double::serialize(self.0, s)
4920                        }
4921                    }
4922                    map.serialize_entry("float64Value", &_W(v))?;
4923                }
4924                Kind::BooleanValue(v) => {
4925                    map.serialize_entry("booleanValue", v)?;
4926                }
4927                Kind::Utf8Value(v) => {
4928                    map.serialize_entry("utf8Value", v)?;
4929                }
4930                Kind::FixedSizeBinaryValue(v) => {
4931                    struct _W<'a>(&'a ::buffa::alloc::vec::Vec<u8>);
4932                    impl serde::Serialize for _W<'_> {
4933                        fn serialize<S2: serde::Serializer>(
4934                            &self,
4935                            s: S2,
4936                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4937                            ::buffa::json_helpers::bytes::serialize(self.0, s)
4938                        }
4939                    }
4940                    map.serialize_entry("fixedSizeBinaryValue", &_W(v))?;
4941                }
4942                Kind::Date32Value(v) => {
4943                    struct _W<'a>(&'a i32);
4944                    impl serde::Serialize for _W<'_> {
4945                        fn serialize<S2: serde::Serializer>(
4946                            &self,
4947                            s: S2,
4948                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4949                            ::buffa::json_helpers::int32::serialize(self.0, s)
4950                        }
4951                    }
4952                    map.serialize_entry("date32Value", &_W(v))?;
4953                }
4954                Kind::Date64Value(v) => {
4955                    struct _W<'a>(&'a i64);
4956                    impl serde::Serialize for _W<'_> {
4957                        fn serialize<S2: serde::Serializer>(
4958                            &self,
4959                            s: S2,
4960                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4961                            ::buffa::json_helpers::int64::serialize(self.0, s)
4962                        }
4963                    }
4964                    map.serialize_entry("date64Value", &_W(v))?;
4965                }
4966                Kind::TimestampValue(v) => {
4967                    struct _W<'a>(&'a i64);
4968                    impl serde::Serialize for _W<'_> {
4969                        fn serialize<S2: serde::Serializer>(
4970                            &self,
4971                            s: S2,
4972                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4973                            ::buffa::json_helpers::int64::serialize(self.0, s)
4974                        }
4975                    }
4976                    map.serialize_entry("timestampValue", &_W(v))?;
4977                }
4978                Kind::Decimal128Value(v) => {
4979                    struct _W<'a>(&'a ::buffa::alloc::vec::Vec<u8>);
4980                    impl serde::Serialize for _W<'_> {
4981                        fn serialize<S2: serde::Serializer>(
4982                            &self,
4983                            s: S2,
4984                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4985                            ::buffa::json_helpers::bytes::serialize(self.0, s)
4986                        }
4987                    }
4988                    map.serialize_entry("decimal128Value", &_W(v))?;
4989                }
4990                Kind::Decimal256Value(v) => {
4991                    struct _W<'a>(&'a ::buffa::alloc::vec::Vec<u8>);
4992                    impl serde::Serialize for _W<'_> {
4993                        fn serialize<S2: serde::Serializer>(
4994                            &self,
4995                            s: S2,
4996                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
4997                            ::buffa::json_helpers::bytes::serialize(self.0, s)
4998                        }
4999                    }
5000                    map.serialize_entry("decimal256Value", &_W(v))?;
5001                }
5002                Kind::ListValue(v) => {
5003                    map.serialize_entry("listValue", v)?;
5004                }
5005            }
5006            map.end()
5007        }
5008    }
5009    #[derive(Clone, Debug)]
5010    pub enum KindView<'a> {
5011        NullValue(::buffa::alloc::boxed::Box<super::NullView<'a>>),
5012        Int64Value(i64),
5013        Uint64Value(u64),
5014        Float64Value(f64),
5015        BooleanValue(bool),
5016        Utf8Value(&'a str),
5017        FixedSizeBinaryValue(&'a [u8]),
5018        Date32Value(i32),
5019        Date64Value(i64),
5020        TimestampValue(i64),
5021        Decimal128Value(&'a [u8]),
5022        Decimal256Value(&'a [u8]),
5023        ListValue(::buffa::alloc::boxed::Box<super::ListValueView<'a>>),
5024    }
5025}
5026
5027/// Full service name for this service.
5028pub const SERVICE_SERVICE_NAME: &str = "store.sql.v1.Service";
5029/// Streaming SQL predicate service over a server-side `KvSchema`.
5030/// The server registers a fixed set of SQL tables at startup (schema lives on
5031/// the server, not the wire). Each RPC names one of those tables.
5032///
5033/// # Implementing handlers
5034///
5035/// Handlers receive requests as `OwnedView<FooView<'static>>`, which gives
5036/// zero-copy borrowed access to fields (e.g. `request.name` is a `&str`
5037/// into the decoded buffer). The view can be held across `.await` points.
5038///
5039/// Implement methods with plain `async fn`; the returned future satisfies
5040/// the `Send` bound automatically. See the
5041/// [buffa user guide](https://github.com/anthropics/buffa/blob/main/docs/guide.md#ownedview-in-async-trait-implementations)
5042/// for zero-copy access patterns and when `to_owned_message()` is needed.
5043#[allow(clippy::type_complexity)]
5044pub trait Service: Send + Sync + 'static {
5045    /// Re-run a SQL WHERE predicate against every incoming batch that touches
5046    /// `table`'s primary-key codec family. Emits one `SubscribeResponse` per
5047    /// matched batch containing just the rows that satisfied the predicate.
5048    fn subscribe(
5049        &self,
5050        ctx: ::connectrpc::Context,
5051        request: ::buffa::view::OwnedView<SubscribeRequestView<'static>>,
5052    ) -> impl ::std::future::Future<
5053        Output = Result<
5054            (
5055                ::std::pin::Pin<
5056                    Box<
5057                        dyn ::futures::Stream<
5058                            Item = Result<SubscribeResponse, ::connectrpc::ConnectError>,
5059                        > + Send,
5060                    >,
5061                >,
5062                ::connectrpc::Context,
5063            ),
5064            ::connectrpc::ConnectError,
5065        >,
5066    > + Send;
5067    /// Ad-hoc unary SQL against the server-side session. Useful for inspecting
5068    /// the current table state alongside the live subscription.
5069    fn query(
5070        &self,
5071        ctx: ::connectrpc::Context,
5072        request: ::buffa::view::OwnedView<QueryRequestView<'static>>,
5073    ) -> impl ::std::future::Future<
5074        Output = Result<
5075            (QueryResponse, ::connectrpc::Context),
5076            ::connectrpc::ConnectError,
5077        >,
5078    > + Send;
5079    /// Describe every registered table. Carries KV-specific metadata
5080    /// (primary-key order, secondary indexes with their layout + cover columns)
5081    /// that DataFusion's `information_schema` doesn't surface.
5082    fn tables(
5083        &self,
5084        ctx: ::connectrpc::Context,
5085        request: ::buffa::view::OwnedView<TablesRequestView<'static>>,
5086    ) -> impl ::std::future::Future<
5087        Output = Result<
5088            (TablesResponse, ::connectrpc::Context),
5089            ::connectrpc::ConnectError,
5090        >,
5091    > + Send;
5092}
5093/// Extension trait for registering a service implementation with a Router.
5094///
5095/// This trait is automatically implemented for all types that implement the service trait.
5096///
5097/// # Example
5098///
5099/// ```rust,ignore
5100/// use std::sync::Arc;
5101///
5102/// let service = Arc::new(MyServiceImpl);
5103/// let router = service.register(Router::new());
5104/// ```
5105pub trait ServiceExt: Service {
5106    /// Register this service implementation with a Router.
5107    ///
5108    /// Takes ownership of the `Arc<Self>` and returns a new Router with
5109    /// this service's methods registered.
5110    fn register(
5111        self: ::std::sync::Arc<Self>,
5112        router: ::connectrpc::Router,
5113    ) -> ::connectrpc::Router;
5114}
5115impl<S: Service> ServiceExt for S {
5116    fn register(
5117        self: ::std::sync::Arc<Self>,
5118        router: ::connectrpc::Router,
5119    ) -> ::connectrpc::Router {
5120        router
5121            .route_view_server_stream(
5122                SERVICE_SERVICE_NAME,
5123                "Subscribe",
5124                ::connectrpc::view_streaming_handler_fn({
5125                    let svc = ::std::sync::Arc::clone(&self);
5126                    move |ctx, req| {
5127                        let svc = ::std::sync::Arc::clone(&svc);
5128                        async move { svc.subscribe(ctx, req).await }
5129                    }
5130                }),
5131            )
5132            .route_view(
5133                SERVICE_SERVICE_NAME,
5134                "Query",
5135                {
5136                    let svc = ::std::sync::Arc::clone(&self);
5137                    ::connectrpc::view_handler_fn(move |ctx, req| {
5138                        let svc = ::std::sync::Arc::clone(&svc);
5139                        async move { svc.query(ctx, req).await }
5140                    })
5141                },
5142            )
5143            .route_view(
5144                SERVICE_SERVICE_NAME,
5145                "Tables",
5146                {
5147                    let svc = ::std::sync::Arc::clone(&self);
5148                    ::connectrpc::view_handler_fn(move |ctx, req| {
5149                        let svc = ::std::sync::Arc::clone(&svc);
5150                        async move { svc.tables(ctx, req).await }
5151                    })
5152                },
5153            )
5154    }
5155}
5156/// Monomorphic dispatcher for `Service`.
5157///
5158/// Unlike `.register(Router)` which type-erases each method into an `Arc<dyn ErasedHandler>` stored in a `HashMap`, this struct dispatches via a compile-time `match` on method name: no vtable, no hash lookup.
5159///
5160/// # Example
5161///
5162/// ```rust,ignore
5163/// use connectrpc::ConnectRpcService;
5164///
5165/// let server = ServiceServer::new(MyImpl);
5166/// let service = ConnectRpcService::new(server);
5167/// // hand `service` to axum/hyper as a fallback_service
5168/// ```
5169pub struct ServiceServer<T> {
5170    inner: ::std::sync::Arc<T>,
5171}
5172impl<T: Service> ServiceServer<T> {
5173    /// Wrap a service implementation in a monomorphic dispatcher.
5174    pub fn new(service: T) -> Self {
5175        Self {
5176            inner: ::std::sync::Arc::new(service),
5177        }
5178    }
5179    /// Wrap an already-`Arc`'d service implementation.
5180    pub fn from_arc(inner: ::std::sync::Arc<T>) -> Self {
5181        Self { inner }
5182    }
5183}
5184impl<T> Clone for ServiceServer<T> {
5185    fn clone(&self) -> Self {
5186        Self {
5187            inner: ::std::sync::Arc::clone(&self.inner),
5188        }
5189    }
5190}
5191impl<T: Service> ::connectrpc::Dispatcher for ServiceServer<T> {
5192    #[inline]
5193    fn lookup(
5194        &self,
5195        path: &str,
5196    ) -> Option<::connectrpc::dispatcher::codegen::MethodDescriptor> {
5197        let method = path.strip_prefix("store.sql.v1.Service/")?;
5198        match method {
5199            "Subscribe" => {
5200                Some(
5201                    ::connectrpc::dispatcher::codegen::MethodDescriptor::server_streaming(),
5202                )
5203            }
5204            "Query" => {
5205                Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false))
5206            }
5207            "Tables" => {
5208                Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false))
5209            }
5210            _ => None,
5211        }
5212    }
5213    fn call_unary(
5214        &self,
5215        path: &str,
5216        ctx: ::connectrpc::Context,
5217        request: ::buffa::bytes::Bytes,
5218        format: ::connectrpc::CodecFormat,
5219    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
5220        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
5221            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
5222        };
5223        let _ = (&ctx, &request, &format);
5224        match method {
5225            "Query" => {
5226                let svc = ::std::sync::Arc::clone(&self.inner);
5227                Box::pin(async move {
5228                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
5229                        QueryRequestView,
5230                    >(request, format)?;
5231                    let (res, ctx) = svc.query(ctx, req).await?;
5232                    let bytes = ::connectrpc::dispatcher::codegen::encode_response(
5233                        &res,
5234                        format,
5235                    )?;
5236                    Ok((bytes, ctx))
5237                })
5238            }
5239            "Tables" => {
5240                let svc = ::std::sync::Arc::clone(&self.inner);
5241                Box::pin(async move {
5242                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
5243                        TablesRequestView,
5244                    >(request, format)?;
5245                    let (res, ctx) = svc.tables(ctx, req).await?;
5246                    let bytes = ::connectrpc::dispatcher::codegen::encode_response(
5247                        &res,
5248                        format,
5249                    )?;
5250                    Ok((bytes, ctx))
5251                })
5252            }
5253            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
5254        }
5255    }
5256    fn call_server_streaming(
5257        &self,
5258        path: &str,
5259        ctx: ::connectrpc::Context,
5260        request: ::buffa::bytes::Bytes,
5261        format: ::connectrpc::CodecFormat,
5262    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
5263        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
5264            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
5265        };
5266        let _ = (&ctx, &request, &format);
5267        match method {
5268            "Subscribe" => {
5269                let svc = ::std::sync::Arc::clone(&self.inner);
5270                Box::pin(async move {
5271                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
5272                        SubscribeRequestView,
5273                    >(request, format)?;
5274                    let (resp_stream, ctx) = svc.subscribe(ctx, req).await?;
5275                    Ok((
5276                        ::connectrpc::dispatcher::codegen::encode_response_stream(
5277                            resp_stream,
5278                            format,
5279                        ),
5280                        ctx,
5281                    ))
5282                })
5283            }
5284            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
5285        }
5286    }
5287    fn call_client_streaming(
5288        &self,
5289        path: &str,
5290        ctx: ::connectrpc::Context,
5291        requests: ::connectrpc::dispatcher::codegen::RequestStream,
5292        format: ::connectrpc::CodecFormat,
5293    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
5294        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
5295            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
5296        };
5297        let _ = (&ctx, &requests, &format);
5298        match method {
5299            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
5300        }
5301    }
5302    fn call_bidi_streaming(
5303        &self,
5304        path: &str,
5305        ctx: ::connectrpc::Context,
5306        requests: ::connectrpc::dispatcher::codegen::RequestStream,
5307        format: ::connectrpc::CodecFormat,
5308    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
5309        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
5310            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
5311        };
5312        let _ = (&ctx, &requests, &format);
5313        match method {
5314            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
5315        }
5316    }
5317}
5318/// Client for this service.
5319///
5320/// Generic over `T: ClientTransport`. For **gRPC** (HTTP/2), use
5321/// `Http2Connection` — it has honest `poll_ready` and composes with
5322/// `tower::balance` for multi-connection load balancing. For **Connect
5323/// over HTTP/1.1** (or unknown protocol), use `HttpClient`.
5324///
5325/// # Example (gRPC / HTTP/2)
5326///
5327/// ```rust,ignore
5328/// use connectrpc::client::{Http2Connection, ClientConfig};
5329/// use connectrpc::Protocol;
5330///
5331/// let uri: http::Uri = "http://localhost:8080".parse()?;
5332/// let conn = Http2Connection::connect_plaintext(uri.clone()).await?.shared(1024);
5333/// let config = ClientConfig::new(uri).protocol(Protocol::Grpc);
5334///
5335/// let client = ServiceClient::new(conn, config);
5336/// let response = client.subscribe(request).await?;
5337/// ```
5338///
5339/// # Example (Connect / HTTP/1.1 or ALPN)
5340///
5341/// ```rust,ignore
5342/// use connectrpc::client::{HttpClient, ClientConfig};
5343///
5344/// let http = HttpClient::plaintext();  // cleartext http:// only
5345/// let config = ClientConfig::new("http://localhost:8080".parse()?);
5346///
5347/// let client = ServiceClient::new(http, config);
5348/// let response = client.subscribe(request).await?;
5349/// ```
5350///
5351/// # Working with the response
5352///
5353/// Unary calls return [`UnaryResponse<OwnedView<FooView>>`](::connectrpc::client::UnaryResponse).
5354/// The `OwnedView` derefs to the view, so field access is zero-copy:
5355///
5356/// ```rust,ignore
5357/// let resp = client.subscribe(request).await?.into_view();
5358/// let name: &str = resp.name;  // borrow into the response buffer
5359/// ```
5360///
5361/// If you need the owned struct (e.g. to store or pass by value), use
5362/// [`into_owned()`](::connectrpc::client::UnaryResponse::into_owned):
5363///
5364/// ```rust,ignore
5365/// let owned = client.subscribe(request).await?.into_owned();
5366/// ```
5367#[derive(Clone)]
5368pub struct ServiceClient<T> {
5369    transport: T,
5370    config: ::connectrpc::client::ClientConfig,
5371}
5372impl<T> ServiceClient<T>
5373where
5374    T: ::connectrpc::client::ClientTransport,
5375    <T::ResponseBody as ::http_body::Body>::Error: ::std::fmt::Display,
5376{
5377    /// Create a new client with the given transport and configuration.
5378    pub fn new(transport: T, config: ::connectrpc::client::ClientConfig) -> Self {
5379        Self { transport, config }
5380    }
5381    /// Get the client configuration.
5382    pub fn config(&self) -> &::connectrpc::client::ClientConfig {
5383        &self.config
5384    }
5385    /// Get a mutable reference to the client configuration.
5386    pub fn config_mut(&mut self) -> &mut ::connectrpc::client::ClientConfig {
5387        &mut self.config
5388    }
5389    /// Call the Subscribe RPC. Sends a request to /store.sql.v1.Service/Subscribe.
5390    pub async fn subscribe(
5391        &self,
5392        request: SubscribeRequest,
5393    ) -> Result<
5394        ::connectrpc::client::ServerStream<
5395            T::ResponseBody,
5396            SubscribeResponseView<'static>,
5397        >,
5398        ::connectrpc::ConnectError,
5399    > {
5400        self.subscribe_with_options(
5401                request,
5402                ::connectrpc::client::CallOptions::default(),
5403            )
5404            .await
5405    }
5406    /// Call the Subscribe RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
5407    pub async fn subscribe_with_options(
5408        &self,
5409        request: SubscribeRequest,
5410        options: ::connectrpc::client::CallOptions,
5411    ) -> Result<
5412        ::connectrpc::client::ServerStream<
5413            T::ResponseBody,
5414            SubscribeResponseView<'static>,
5415        >,
5416        ::connectrpc::ConnectError,
5417    > {
5418        ::connectrpc::client::call_server_stream(
5419                &self.transport,
5420                &self.config,
5421                SERVICE_SERVICE_NAME,
5422                "Subscribe",
5423                request,
5424                options,
5425            )
5426            .await
5427    }
5428    /// Call the Query RPC. Sends a request to /store.sql.v1.Service/Query.
5429    pub async fn query(
5430        &self,
5431        request: QueryRequest,
5432    ) -> Result<
5433        ::connectrpc::client::UnaryResponse<
5434            ::buffa::view::OwnedView<QueryResponseView<'static>>,
5435        >,
5436        ::connectrpc::ConnectError,
5437    > {
5438        self.query_with_options(request, ::connectrpc::client::CallOptions::default())
5439            .await
5440    }
5441    /// Call the Query RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
5442    pub async fn query_with_options(
5443        &self,
5444        request: QueryRequest,
5445        options: ::connectrpc::client::CallOptions,
5446    ) -> Result<
5447        ::connectrpc::client::UnaryResponse<
5448            ::buffa::view::OwnedView<QueryResponseView<'static>>,
5449        >,
5450        ::connectrpc::ConnectError,
5451    > {
5452        ::connectrpc::client::call_unary(
5453                &self.transport,
5454                &self.config,
5455                SERVICE_SERVICE_NAME,
5456                "Query",
5457                request,
5458                options,
5459            )
5460            .await
5461    }
5462    /// Call the Tables RPC. Sends a request to /store.sql.v1.Service/Tables.
5463    pub async fn tables(
5464        &self,
5465        request: TablesRequest,
5466    ) -> Result<
5467        ::connectrpc::client::UnaryResponse<
5468            ::buffa::view::OwnedView<TablesResponseView<'static>>,
5469        >,
5470        ::connectrpc::ConnectError,
5471    > {
5472        self.tables_with_options(request, ::connectrpc::client::CallOptions::default())
5473            .await
5474    }
5475    /// Call the Tables RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
5476    pub async fn tables_with_options(
5477        &self,
5478        request: TablesRequest,
5479        options: ::connectrpc::client::CallOptions,
5480    ) -> Result<
5481        ::connectrpc::client::UnaryResponse<
5482            ::buffa::view::OwnedView<TablesResponseView<'static>>,
5483        >,
5484        ::connectrpc::ConnectError,
5485    > {
5486        ::connectrpc::client::call_unary(
5487                &self.transport,
5488                &self.config,
5489                SERVICE_SERVICE_NAME,
5490                "Tables",
5491                request,
5492                options,
5493            )
5494            .await
5495    }
5496}