// @generated by protoc-gen-buffa. DO NOT EDIT.
// source: store/v1/sql.proto

/// Key layout of a secondary index.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum IndexLayout {
    /// Standard lexicographic concatenation of key columns.
    INDEX_LAYOUT_LEXICOGRAPHIC = 0i32,
    /// Z-order (Morton) interleaving of the key columns' bits, for
    /// multi-dimensional range scans.
    INDEX_LAYOUT_Z_ORDER = 1i32,
}
impl ::core::default::Default for IndexLayout {
    fn default() -> Self {
        Self::INDEX_LAYOUT_LEXICOGRAPHIC
    }
}
impl ::serde::Serialize for IndexLayout {
    fn serialize<S: ::serde::Serializer>(
        &self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        s.serialize_str(::buffa::Enumeration::proto_name(self))
    }
}
impl<'de> ::serde::Deserialize<'de> for IndexLayout {
    fn deserialize<D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        struct _V;
        impl ::serde::de::Visitor<'_> for _V {
            type Value = IndexLayout;
            fn expecting(
                &self,
                f: &mut ::core::fmt::Formatter<'_>,
            ) -> ::core::fmt::Result {
                f.write_str(
                    concat!("a string, integer, or null for ", stringify!(IndexLayout)),
                )
            }
            fn visit_str<E: ::serde::de::Error>(
                self,
                v: &str,
            ) -> ::core::result::Result<IndexLayout, E> {
                <IndexLayout as ::buffa::Enumeration>::from_proto_name(v)
                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
            }
            fn visit_i64<E: ::serde::de::Error>(
                self,
                v: i64,
            ) -> ::core::result::Result<IndexLayout, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <IndexLayout as ::buffa::Enumeration>::from_i32(v32)
                    .ok_or_else(|| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("unknown enum value {}", v32),
                        )
                    })
            }
            fn visit_u64<E: ::serde::de::Error>(
                self,
                v: u64,
            ) -> ::core::result::Result<IndexLayout, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <IndexLayout as ::buffa::Enumeration>::from_i32(v32)
                    .ok_or_else(|| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("unknown enum value {}", v32),
                        )
                    })
            }
            fn visit_unit<E: ::serde::de::Error>(
                self,
            ) -> ::core::result::Result<IndexLayout, E> {
                ::core::result::Result::Ok(::core::default::Default::default())
            }
        }
        d.deserialize_any(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for IndexLayout {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
impl ::buffa::Enumeration for IndexLayout {
    fn from_i32(value: i32) -> ::core::option::Option<Self> {
        match value {
            0i32 => ::core::option::Option::Some(Self::INDEX_LAYOUT_LEXICOGRAPHIC),
            1i32 => ::core::option::Option::Some(Self::INDEX_LAYOUT_Z_ORDER),
            _ => ::core::option::Option::None,
        }
    }
    fn to_i32(&self) -> i32 {
        *self as i32
    }
    fn proto_name(&self) -> &'static str {
        match self {
            Self::INDEX_LAYOUT_LEXICOGRAPHIC => "INDEX_LAYOUT_LEXICOGRAPHIC",
            Self::INDEX_LAYOUT_Z_ORDER => "INDEX_LAYOUT_Z_ORDER",
        }
    }
    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
        match name {
            "INDEX_LAYOUT_LEXICOGRAPHIC" => {
                ::core::option::Option::Some(Self::INDEX_LAYOUT_LEXICOGRAPHIC)
            }
            "INDEX_LAYOUT_Z_ORDER" => {
                ::core::option::Option::Some(Self::INDEX_LAYOUT_Z_ORDER)
            }
            _ => ::core::option::Option::None,
        }
    }
}
/// Stream every batch whose rows match `where_sql`.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct SubscribeRequest {
    /// Table name registered in the server-side `KvSchema`.
    ///
    /// Field 1: `table`
    #[serde(
        rename = "table",
        with = "::buffa::json_helpers::proto_string",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
    )]
    pub table: ::buffa::alloc::string::String,
    /// SQL boolean predicate evaluated against the decoded rows from each
    /// incoming batch (no `WHERE` keyword). Empty means "emit every decoded
    /// row". Bounded to keep server-side compile cost predictable.
    ///
    /// Field 2: `where_sql`
    #[serde(
        rename = "whereSql",
        alias = "where_sql",
        with = "::buffa::json_helpers::proto_string",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
    )]
    pub where_sql: ::buffa::alloc::string::String,
    /// Resume cursor over the underlying store batch log. Use
    /// `SubscribeResponse.sequence_number + 1` to resume after a disconnect.
    ///
    /// Field 3: `since_sequence_number`
    #[serde(
        rename = "sinceSequenceNumber",
        alias = "since_sequence_number",
        with = "::buffa::json_helpers::opt_uint64",
        skip_serializing_if = "Option::is_none"
    )]
    pub since_sequence_number: Option<u64>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for SubscribeRequest {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("SubscribeRequest")
            .field("table", &self.table)
            .field("where_sql", &self.where_sql)
            .field("since_sequence_number", &self.since_sequence_number)
            .finish()
    }
}
impl SubscribeRequest {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.SubscribeRequest";
}
unsafe impl ::buffa::DefaultInstance for SubscribeRequest {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<SubscribeRequest> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for SubscribeRequest {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        if !self.table.is_empty() {
            size += 1u32 + ::buffa::types::string_encoded_len(&self.table) as u32;
        }
        if !self.where_sql.is_empty() {
            size += 1u32 + ::buffa::types::string_encoded_len(&self.where_sql) as u32;
        }
        if let Some(v) = self.since_sequence_number {
            size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if !self.table.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(&self.table, buf);
        }
        if !self.where_sql.is_empty() {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(&self.where_sql, buf);
        }
        if let Some(v) = self.since_sequence_number {
            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_uint64(v, buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                ::buffa::types::merge_string(&mut self.table, buf)?;
            }
            2u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                ::buffa::types::merge_string(&mut self.where_sql, buf)?;
            }
            3u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 3u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.since_sequence_number = ::core::option::Option::Some(
                    ::buffa::types::decode_uint64(buf)?,
                );
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.table.clear();
        self.where_sql.clear();
        self.since_sequence_number = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for SubscribeRequest {
    const PROTO_FQN: &'static str = "store.sql.v1.SubscribeRequest";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for SubscribeRequest {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __SUBSCRIBE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.SubscribeRequest",
    to_json: ::buffa::type_registry::any_to_json::<SubscribeRequest>,
    from_json: ::buffa::type_registry::any_from_json::<SubscribeRequest>,
    is_wkt: false,
};
/// Stream every batch whose rows match `where_sql`.
#[derive(Clone, Debug, Default)]
pub struct SubscribeRequestView<'a> {
    /// Table name registered in the server-side `KvSchema`.
    ///
    /// Field 1: `table`
    pub table: &'a str,
    /// SQL boolean predicate evaluated against the decoded rows from each
    /// incoming batch (no `WHERE` keyword). Empty means "emit every decoded
    /// row". Bounded to keep server-side compile cost predictable.
    ///
    /// Field 2: `where_sql`
    pub where_sql: &'a str,
    /// Resume cursor over the underlying store batch log. Use
    /// `SubscribeResponse.sequence_number + 1` to resume after a disconnect.
    ///
    /// Field 3: `since_sequence_number`
    pub since_sequence_number: ::core::option::Option<u64>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> SubscribeRequestView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.table = ::buffa::types::borrow_str(&mut cur)?;
                }
                2u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.where_sql = ::buffa::types::borrow_str(&mut cur)?;
                }
                3u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 3u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.since_sequence_number = Some(
                        ::buffa::types::decode_uint64(&mut cur)?,
                    );
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for SubscribeRequestView<'a> {
    type Owned = SubscribeRequest;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> SubscribeRequest {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        SubscribeRequest {
            table: self.table.to_string(),
            where_sql: self.where_sql.to_string(),
            since_sequence_number: self.since_sequence_number,
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for SubscribeRequestView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<SubscribeRequestView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for SubscribeRequestView<'a> {
    type Static = SubscribeRequestView<'static>;
}
/// Rows from one atomic ingest batch that matched the subscriber's predicate.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct SubscribeResponse {
    /// Underlying store batch sequence that produced these rows. Always
    /// monotonically increasing; unique per delivered frame.
    ///
    /// Field 1: `sequence_number`
    #[serde(
        rename = "sequenceNumber",
        alias = "sequence_number",
        with = "::buffa::json_helpers::uint64",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
    )]
    pub sequence_number: u64,
    /// Column names in `rows[].cells` order.
    ///
    /// Field 2: `column`
    #[serde(
        rename = "column",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub column: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
    /// Rows that satisfied `where_sql` from this batch. Empty frames are not
    /// delivered.
    ///
    /// Field 3: `rows`
    #[serde(
        rename = "rows",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub rows: ::buffa::alloc::vec::Vec<Row>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for SubscribeResponse {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("SubscribeResponse")
            .field("sequence_number", &self.sequence_number)
            .field("column", &self.column)
            .field("rows", &self.rows)
            .finish()
    }
}
impl SubscribeResponse {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.SubscribeResponse";
}
unsafe impl ::buffa::DefaultInstance for SubscribeResponse {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<SubscribeResponse> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for SubscribeResponse {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        if self.sequence_number != 0u64 {
            size
                += 1u32
                    + ::buffa::types::uint64_encoded_len(self.sequence_number) as u32;
        }
        for v in &self.column {
            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
        }
        for v in &self.rows {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if self.sequence_number != 0u64 {
            ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_uint64(self.sequence_number, buf);
        }
        for v in &self.column {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(v, buf);
        }
        for v in &self.rows {
            ::buffa::encoding::Tag::new(
                    3u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
            v.write_to(buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.sequence_number = ::buffa::types::decode_uint64(buf)?;
            }
            2u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.column.push(::buffa::types::decode_string(buf)?);
            }
            3u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 3u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.rows.push(elem);
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.sequence_number = 0u64;
        self.column.clear();
        self.rows.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for SubscribeResponse {
    const PROTO_FQN: &'static str = "store.sql.v1.SubscribeResponse";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for SubscribeResponse {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __SUBSCRIBE_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.SubscribeResponse",
    to_json: ::buffa::type_registry::any_to_json::<SubscribeResponse>,
    from_json: ::buffa::type_registry::any_from_json::<SubscribeResponse>,
    is_wkt: false,
};
/// Rows from one atomic ingest batch that matched the subscriber's predicate.
#[derive(Clone, Debug, Default)]
pub struct SubscribeResponseView<'a> {
    /// Underlying store batch sequence that produced these rows. Always
    /// monotonically increasing; unique per delivered frame.
    ///
    /// Field 1: `sequence_number`
    pub sequence_number: u64,
    /// Column names in `rows[].cells` order.
    ///
    /// Field 2: `column`
    pub column: ::buffa::RepeatedView<'a, &'a str>,
    /// Rows that satisfied `where_sql` from this batch. Empty frames are not
    /// delivered.
    ///
    /// Field 3: `rows`
    pub rows: ::buffa::RepeatedView<'a, RowView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> SubscribeResponseView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.sequence_number = ::buffa::types::decode_uint64(&mut cur)?;
                }
                2u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.column.push(::buffa::types::borrow_str(&mut cur)?);
                }
                3u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 3u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    view.rows.push(RowView::_decode_depth(sub, depth - 1)?);
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for SubscribeResponseView<'a> {
    type Owned = SubscribeResponse;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> SubscribeResponse {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        SubscribeResponse {
            sequence_number: self.sequence_number,
            column: self.column.iter().map(|s| s.to_string()).collect(),
            rows: self.rows.iter().map(|v| v.to_owned_message()).collect(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for SubscribeResponseView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<SubscribeResponseView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for SubscribeResponseView<'a> {
    type Static = SubscribeResponseView<'static>;
}
/// Discovery request; currently has no parameters.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct TablesRequest {
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for TablesRequest {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("TablesRequest").finish()
    }
}
impl TablesRequest {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.TablesRequest";
}
unsafe impl ::buffa::DefaultInstance for TablesRequest {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<TablesRequest> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for TablesRequest {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for TablesRequest {
    const PROTO_FQN: &'static str = "store.sql.v1.TablesRequest";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for TablesRequest {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __TABLES_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.TablesRequest",
    to_json: ::buffa::type_registry::any_to_json::<TablesRequest>,
    from_json: ::buffa::type_registry::any_from_json::<TablesRequest>,
    is_wkt: false,
};
/// Discovery request; currently has no parameters.
#[derive(Clone, Debug, Default)]
pub struct TablesRequestView<'a> {
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> TablesRequestView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for TablesRequestView<'a> {
    type Owned = TablesRequest;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> TablesRequest {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        TablesRequest {
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for TablesRequestView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<TablesRequestView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for TablesRequestView<'a> {
    type Static = TablesRequestView<'static>;
}
/// Describes every table registered in the server-side `KvSchema`.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct TablesResponse {
    /// Field 1: `tables`
    #[serde(
        rename = "tables",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub tables: ::buffa::alloc::vec::Vec<Table>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for TablesResponse {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("TablesResponse").field("tables", &self.tables).finish()
    }
}
impl TablesResponse {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.TablesResponse";
}
unsafe impl ::buffa::DefaultInstance for TablesResponse {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<TablesResponse> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for TablesResponse {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        for v in &self.tables {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        for v in &self.tables {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
            v.write_to(buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.tables.push(elem);
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.tables.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for TablesResponse {
    const PROTO_FQN: &'static str = "store.sql.v1.TablesResponse";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for TablesResponse {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __TABLES_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.TablesResponse",
    to_json: ::buffa::type_registry::any_to_json::<TablesResponse>,
    from_json: ::buffa::type_registry::any_from_json::<TablesResponse>,
    is_wkt: false,
};
/// Describes every table registered in the server-side `KvSchema`.
#[derive(Clone, Debug, Default)]
pub struct TablesResponseView<'a> {
    /// Field 1: `tables`
    pub tables: ::buffa::RepeatedView<'a, TableView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> TablesResponseView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    view.tables.push(TableView::_decode_depth(sub, depth - 1)?);
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for TablesResponseView<'a> {
    type Owned = TablesResponse;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> TablesResponse {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        TablesResponse {
            tables: self.tables.iter().map(|v| v.to_owned_message()).collect(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for TablesResponseView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<TablesResponseView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for TablesResponseView<'a> {
    type Static = TablesResponseView<'static>;
}
/// Server-registered table.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct Table {
    /// Name clients pass to `Subscribe.table` / reference in `Query.sql`.
    ///
    /// Field 1: `name`
    #[serde(
        rename = "name",
        with = "::buffa::json_helpers::proto_string",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
    )]
    pub name: ::buffa::alloc::string::String,
    /// Columns in declaration order. `Subscribe` emits rows in this order.
    ///
    /// Field 2: `columns`
    #[serde(
        rename = "columns",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub columns: ::buffa::alloc::vec::Vec<Column>,
    /// Indices into `columns` that form the primary key, in key-sort order.
    ///
    /// Field 3: `primary_key_columns`
    #[serde(
        rename = "primaryKeyColumns",
        alias = "primary_key_columns",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub primary_key_columns: ::buffa::alloc::vec::Vec<u32>,
    /// Secondary indexes declared on this table, in registration order.
    ///
    /// Field 4: `indexes`
    #[serde(
        rename = "indexes",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub indexes: ::buffa::alloc::vec::Vec<Index>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for Table {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Table")
            .field("name", &self.name)
            .field("columns", &self.columns)
            .field("primary_key_columns", &self.primary_key_columns)
            .field("indexes", &self.indexes)
            .finish()
    }
}
impl Table {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Table";
}
unsafe impl ::buffa::DefaultInstance for Table {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Table> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for Table {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        if !self.name.is_empty() {
            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
        }
        for v in &self.columns {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        if !self.primary_key_columns.is_empty() {
            let payload: u32 = self
                .primary_key_columns
                .iter()
                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
                .sum::<u32>();
            size
                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
        }
        for v in &self.indexes {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if !self.name.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(&self.name, buf);
        }
        for v in &self.columns {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
            v.write_to(buf);
        }
        if !self.primary_key_columns.is_empty() {
            let payload: u32 = self
                .primary_key_columns
                .iter()
                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
                .sum::<u32>();
            ::buffa::encoding::Tag::new(
                    3u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(payload as u64, buf);
            for &v in &self.primary_key_columns {
                ::buffa::types::encode_uint32(v, buf);
            }
        }
        for v in &self.indexes {
            ::buffa::encoding::Tag::new(
                    4u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
            v.write_to(buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                ::buffa::types::merge_string(&mut self.name, buf)?;
            }
            2u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.columns.push(elem);
            }
            3u32 => {
                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                    let len = ::buffa::encoding::decode_varint(buf)?;
                    let len = usize::try_from(len)
                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
                    if buf.remaining() < len {
                        return ::core::result::Result::Err(
                            ::buffa::DecodeError::UnexpectedEof,
                        );
                    }
                    self.primary_key_columns.reserve(len);
                    let mut limited = buf.take(len);
                    while limited.has_remaining() {
                        self.primary_key_columns
                            .push(::buffa::types::decode_uint32(&mut limited)?);
                    }
                    let leftover = limited.remaining();
                    if leftover > 0 {
                        limited.advance(leftover);
                    }
                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                    self.primary_key_columns.push(::buffa::types::decode_uint32(buf)?);
                } else {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 3u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
            }
            4u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 4u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.indexes.push(elem);
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.name.clear();
        self.columns.clear();
        self.primary_key_columns.clear();
        self.indexes.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for Table {
    const PROTO_FQN: &'static str = "store.sql.v1.Table";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for Table {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __TABLE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.Table",
    to_json: ::buffa::type_registry::any_to_json::<Table>,
    from_json: ::buffa::type_registry::any_from_json::<Table>,
    is_wkt: false,
};
/// Server-registered table.
#[derive(Clone, Debug, Default)]
pub struct TableView<'a> {
    /// Name clients pass to `Subscribe.table` / reference in `Query.sql`.
    ///
    /// Field 1: `name`
    pub name: &'a str,
    /// Columns in declaration order. `Subscribe` emits rows in this order.
    ///
    /// Field 2: `columns`
    pub columns: ::buffa::RepeatedView<'a, ColumnView<'a>>,
    /// Indices into `columns` that form the primary key, in key-sort order.
    ///
    /// Field 3: `primary_key_columns`
    pub primary_key_columns: ::buffa::RepeatedView<'a, u32>,
    /// Secondary indexes declared on this table, in registration order.
    ///
    /// Field 4: `indexes`
    pub indexes: ::buffa::RepeatedView<'a, IndexView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> TableView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.name = ::buffa::types::borrow_str(&mut cur)?;
                }
                2u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    view.columns.push(ColumnView::_decode_depth(sub, depth - 1)?);
                }
                3u32 => {
                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
                        let mut pcur: &[u8] = payload;
                        while !pcur.is_empty() {
                            view.primary_key_columns
                                .push(::buffa::types::decode_uint32(&mut pcur)?);
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        view.primary_key_columns
                            .push(::buffa::types::decode_uint32(&mut cur)?);
                    } else {
                        return Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 3u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                }
                4u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    view.indexes.push(IndexView::_decode_depth(sub, depth - 1)?);
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for TableView<'a> {
    type Owned = Table;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> Table {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        Table {
            name: self.name.to_string(),
            columns: self.columns.iter().map(|v| v.to_owned_message()).collect(),
            primary_key_columns: self.primary_key_columns.to_vec(),
            indexes: self.indexes.iter().map(|v| v.to_owned_message()).collect(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for TableView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<TableView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for TableView<'a> {
    type Static = TableView<'static>;
}
/// One column of a registered `Table`.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct Column {
    /// Field 1: `name`
    #[serde(
        rename = "name",
        with = "::buffa::json_helpers::proto_string",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
    )]
    pub name: ::buffa::alloc::string::String,
    /// Arrow DataType rendered as its stable debug string (e.g. `Int64`,
    /// `Utf8`, `Timestamp(Microsecond, None)`, `Decimal128(38, 10)`). Clients
    /// that need typed handling should match against these exact strings.
    ///
    /// Field 2: `data_type`
    #[serde(
        rename = "dataType",
        alias = "data_type",
        with = "::buffa::json_helpers::proto_string",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
    )]
    pub data_type: ::buffa::alloc::string::String,
    /// Field 3: `nullable`
    #[serde(
        rename = "nullable",
        with = "::buffa::json_helpers::proto_bool",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
    )]
    pub nullable: bool,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for Column {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Column")
            .field("name", &self.name)
            .field("data_type", &self.data_type)
            .field("nullable", &self.nullable)
            .finish()
    }
}
impl Column {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Column";
}
unsafe impl ::buffa::DefaultInstance for Column {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Column> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for Column {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        if !self.name.is_empty() {
            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
        }
        if !self.data_type.is_empty() {
            size += 1u32 + ::buffa::types::string_encoded_len(&self.data_type) as u32;
        }
        if self.nullable {
            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if !self.name.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(&self.name, buf);
        }
        if !self.data_type.is_empty() {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(&self.data_type, buf);
        }
        if self.nullable {
            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_bool(self.nullable, buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                ::buffa::types::merge_string(&mut self.name, buf)?;
            }
            2u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                ::buffa::types::merge_string(&mut self.data_type, buf)?;
            }
            3u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 3u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.nullable = ::buffa::types::decode_bool(buf)?;
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.name.clear();
        self.data_type.clear();
        self.nullable = false;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for Column {
    const PROTO_FQN: &'static str = "store.sql.v1.Column";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for Column {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __COLUMN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.Column",
    to_json: ::buffa::type_registry::any_to_json::<Column>,
    from_json: ::buffa::type_registry::any_from_json::<Column>,
    is_wkt: false,
};
/// One column of a registered `Table`.
#[derive(Clone, Debug, Default)]
pub struct ColumnView<'a> {
    /// Field 1: `name`
    pub name: &'a str,
    /// Arrow DataType rendered as its stable debug string (e.g. `Int64`,
    /// `Utf8`, `Timestamp(Microsecond, None)`, `Decimal128(38, 10)`). Clients
    /// that need typed handling should match against these exact strings.
    ///
    /// Field 2: `data_type`
    pub data_type: &'a str,
    /// Field 3: `nullable`
    pub nullable: bool,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ColumnView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.name = ::buffa::types::borrow_str(&mut cur)?;
                }
                2u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.data_type = ::buffa::types::borrow_str(&mut cur)?;
                }
                3u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 3u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.nullable = ::buffa::types::decode_bool(&mut cur)?;
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for ColumnView<'a> {
    type Owned = Column;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> Column {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        Column {
            name: self.name.to_string(),
            data_type: self.data_type.to_string(),
            nullable: self.nullable,
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for ColumnView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ColumnView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for ColumnView<'a> {
    type Static = ColumnView<'static>;
}
/// Secondary index declared on a `Table`.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct Index {
    /// Field 1: `name`
    #[serde(
        rename = "name",
        with = "::buffa::json_helpers::proto_string",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
    )]
    pub name: ::buffa::alloc::string::String,
    /// Field 2: `layout`
    #[serde(
        rename = "layout",
        with = "::buffa::json_helpers::proto_enum",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
    )]
    pub layout: ::buffa::EnumValue<IndexLayout>,
    /// Indices into `Table.columns` that make up the index key, in sort order.
    ///
    /// Field 3: `key_columns`
    #[serde(
        rename = "keyColumns",
        alias = "key_columns",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub key_columns: ::buffa::alloc::vec::Vec<u32>,
    /// Additional column indices stored in the index payload so point lookups
    /// through this index don't need a base-row fetch ("covered" columns).
    ///
    /// Field 4: `cover_columns`
    #[serde(
        rename = "coverColumns",
        alias = "cover_columns",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub cover_columns: ::buffa::alloc::vec::Vec<u32>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for Index {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Index")
            .field("name", &self.name)
            .field("layout", &self.layout)
            .field("key_columns", &self.key_columns)
            .field("cover_columns", &self.cover_columns)
            .finish()
    }
}
impl Index {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Index";
}
unsafe impl ::buffa::DefaultInstance for Index {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Index> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for Index {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        if !self.name.is_empty() {
            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
        }
        {
            let val = self.layout.to_i32();
            if val != 0 {
                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
            }
        }
        if !self.key_columns.is_empty() {
            let payload: u32 = self
                .key_columns
                .iter()
                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
                .sum::<u32>();
            size
                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
        }
        if !self.cover_columns.is_empty() {
            let payload: u32 = self
                .cover_columns
                .iter()
                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
                .sum::<u32>();
            size
                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if !self.name.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(&self.name, buf);
        }
        {
            let val = self.layout.to_i32();
            if val != 0 {
                ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_int32(val, buf);
            }
        }
        if !self.key_columns.is_empty() {
            let payload: u32 = self
                .key_columns
                .iter()
                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
                .sum::<u32>();
            ::buffa::encoding::Tag::new(
                    3u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(payload as u64, buf);
            for &v in &self.key_columns {
                ::buffa::types::encode_uint32(v, buf);
            }
        }
        if !self.cover_columns.is_empty() {
            let payload: u32 = self
                .cover_columns
                .iter()
                .map(|&v| ::buffa::types::uint32_encoded_len(v) as u32)
                .sum::<u32>();
            ::buffa::encoding::Tag::new(
                    4u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(payload as u64, buf);
            for &v in &self.cover_columns {
                ::buffa::types::encode_uint32(v, buf);
            }
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                ::buffa::types::merge_string(&mut self.name, buf)?;
            }
            2u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.layout = ::buffa::EnumValue::from(
                    ::buffa::types::decode_int32(buf)?,
                );
            }
            3u32 => {
                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                    let len = ::buffa::encoding::decode_varint(buf)?;
                    let len = usize::try_from(len)
                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
                    if buf.remaining() < len {
                        return ::core::result::Result::Err(
                            ::buffa::DecodeError::UnexpectedEof,
                        );
                    }
                    self.key_columns.reserve(len);
                    let mut limited = buf.take(len);
                    while limited.has_remaining() {
                        self.key_columns
                            .push(::buffa::types::decode_uint32(&mut limited)?);
                    }
                    let leftover = limited.remaining();
                    if leftover > 0 {
                        limited.advance(leftover);
                    }
                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                    self.key_columns.push(::buffa::types::decode_uint32(buf)?);
                } else {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 3u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
            }
            4u32 => {
                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                    let len = ::buffa::encoding::decode_varint(buf)?;
                    let len = usize::try_from(len)
                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
                    if buf.remaining() < len {
                        return ::core::result::Result::Err(
                            ::buffa::DecodeError::UnexpectedEof,
                        );
                    }
                    self.cover_columns.reserve(len);
                    let mut limited = buf.take(len);
                    while limited.has_remaining() {
                        self.cover_columns
                            .push(::buffa::types::decode_uint32(&mut limited)?);
                    }
                    let leftover = limited.remaining();
                    if leftover > 0 {
                        limited.advance(leftover);
                    }
                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                    self.cover_columns.push(::buffa::types::decode_uint32(buf)?);
                } else {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 4u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.name.clear();
        self.layout = ::buffa::EnumValue::from(0);
        self.key_columns.clear();
        self.cover_columns.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for Index {
    const PROTO_FQN: &'static str = "store.sql.v1.Index";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for Index {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __INDEX_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.Index",
    to_json: ::buffa::type_registry::any_to_json::<Index>,
    from_json: ::buffa::type_registry::any_from_json::<Index>,
    is_wkt: false,
};
/// Secondary index declared on a `Table`.
#[derive(Clone, Debug, Default)]
pub struct IndexView<'a> {
    /// Field 1: `name`
    pub name: &'a str,
    /// Field 2: `layout`
    pub layout: ::buffa::EnumValue<IndexLayout>,
    /// Indices into `Table.columns` that make up the index key, in sort order.
    ///
    /// Field 3: `key_columns`
    pub key_columns: ::buffa::RepeatedView<'a, u32>,
    /// Additional column indices stored in the index payload so point lookups
    /// through this index don't need a base-row fetch ("covered" columns).
    ///
    /// Field 4: `cover_columns`
    pub cover_columns: ::buffa::RepeatedView<'a, u32>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> IndexView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.name = ::buffa::types::borrow_str(&mut cur)?;
                }
                2u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.layout = ::buffa::EnumValue::from(
                        ::buffa::types::decode_int32(&mut cur)?,
                    );
                }
                3u32 => {
                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
                        let mut pcur: &[u8] = payload;
                        while !pcur.is_empty() {
                            view.key_columns
                                .push(::buffa::types::decode_uint32(&mut pcur)?);
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        view.key_columns.push(::buffa::types::decode_uint32(&mut cur)?);
                    } else {
                        return Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 3u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                }
                4u32 => {
                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
                        let mut pcur: &[u8] = payload;
                        while !pcur.is_empty() {
                            view.cover_columns
                                .push(::buffa::types::decode_uint32(&mut pcur)?);
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        view.cover_columns
                            .push(::buffa::types::decode_uint32(&mut cur)?);
                    } else {
                        return Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for IndexView<'a> {
    type Owned = Index;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> Index {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        Index {
            name: self.name.to_string(),
            layout: self.layout,
            key_columns: self.key_columns.to_vec(),
            cover_columns: self.cover_columns.to_vec(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for IndexView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<IndexView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for IndexView<'a> {
    type Static = IndexView<'static>;
}
/// Ad-hoc SQL statement.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct QueryRequest {
    /// Field 1: `sql`
    #[serde(
        rename = "sql",
        with = "::buffa::json_helpers::proto_string",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
    )]
    pub sql: ::buffa::alloc::string::String,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for QueryRequest {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("QueryRequest").field("sql", &self.sql).finish()
    }
}
impl QueryRequest {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.QueryRequest";
}
unsafe impl ::buffa::DefaultInstance for QueryRequest {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<QueryRequest> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for QueryRequest {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        if !self.sql.is_empty() {
            size += 1u32 + ::buffa::types::string_encoded_len(&self.sql) as u32;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if !self.sql.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(&self.sql, buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                ::buffa::types::merge_string(&mut self.sql, buf)?;
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.sql.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for QueryRequest {
    const PROTO_FQN: &'static str = "store.sql.v1.QueryRequest";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for QueryRequest {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __QUERY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.QueryRequest",
    to_json: ::buffa::type_registry::any_to_json::<QueryRequest>,
    from_json: ::buffa::type_registry::any_from_json::<QueryRequest>,
    is_wkt: false,
};
/// Ad-hoc SQL statement.
#[derive(Clone, Debug, Default)]
pub struct QueryRequestView<'a> {
    /// Field 1: `sql`
    pub sql: &'a str,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> QueryRequestView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.sql = ::buffa::types::borrow_str(&mut cur)?;
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for QueryRequestView<'a> {
    type Owned = QueryRequest;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> QueryRequest {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        QueryRequest {
            sql: self.sql.to_string(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for QueryRequestView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<QueryRequestView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for QueryRequestView<'a> {
    type Static = QueryRequestView<'static>;
}
/// Result set from `Query`.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct QueryResponse {
    /// Field 1: `column`
    #[serde(
        rename = "column",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub column: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
    /// Field 2: `rows`
    #[serde(
        rename = "rows",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub rows: ::buffa::alloc::vec::Vec<Row>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for QueryResponse {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("QueryResponse")
            .field("column", &self.column)
            .field("rows", &self.rows)
            .finish()
    }
}
impl QueryResponse {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.QueryResponse";
}
unsafe impl ::buffa::DefaultInstance for QueryResponse {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<QueryResponse> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for QueryResponse {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        for v in &self.column {
            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
        }
        for v in &self.rows {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        for v in &self.column {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(v, buf);
        }
        for v in &self.rows {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
            v.write_to(buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.column.push(::buffa::types::decode_string(buf)?);
            }
            2u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.rows.push(elem);
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.column.clear();
        self.rows.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for QueryResponse {
    const PROTO_FQN: &'static str = "store.sql.v1.QueryResponse";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for QueryResponse {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __QUERY_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.QueryResponse",
    to_json: ::buffa::type_registry::any_to_json::<QueryResponse>,
    from_json: ::buffa::type_registry::any_from_json::<QueryResponse>,
    is_wkt: false,
};
/// Result set from `Query`.
#[derive(Clone, Debug, Default)]
pub struct QueryResponseView<'a> {
    /// Field 1: `column`
    pub column: ::buffa::RepeatedView<'a, &'a str>,
    /// Field 2: `rows`
    pub rows: ::buffa::RepeatedView<'a, RowView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> QueryResponseView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.column.push(::buffa::types::borrow_str(&mut cur)?);
                }
                2u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    view.rows.push(RowView::_decode_depth(sub, depth - 1)?);
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for QueryResponseView<'a> {
    type Owned = QueryResponse;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> QueryResponse {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        QueryResponse {
            column: self.column.iter().map(|s| s.to_string()).collect(),
            rows: self.rows.iter().map(|v| v.to_owned_message()).collect(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for QueryResponseView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<QueryResponseView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for QueryResponseView<'a> {
    type Static = QueryResponseView<'static>;
}
/// Typed row. `cells[i]` aligns with `column[i]` in the parent message.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct Row {
    /// Field 1: `cells`
    #[serde(
        rename = "cells",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub cells: ::buffa::alloc::vec::Vec<Cell>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for Row {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Row").field("cells", &self.cells).finish()
    }
}
impl Row {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Row";
}
unsafe impl ::buffa::DefaultInstance for Row {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Row> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for Row {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        for v in &self.cells {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        for v in &self.cells {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
            v.write_to(buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.cells.push(elem);
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.cells.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for Row {
    const PROTO_FQN: &'static str = "store.sql.v1.Row";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for Row {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __ROW_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.Row",
    to_json: ::buffa::type_registry::any_to_json::<Row>,
    from_json: ::buffa::type_registry::any_from_json::<Row>,
    is_wkt: false,
};
/// Typed row. `cells[i]` aligns with `column[i]` in the parent message.
#[derive(Clone, Debug, Default)]
pub struct RowView<'a> {
    /// Field 1: `cells`
    pub cells: ::buffa::RepeatedView<'a, CellView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RowView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    view.cells.push(CellView::_decode_depth(sub, depth - 1)?);
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for RowView<'a> {
    type Owned = Row;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> Row {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        Row {
            cells: self.cells.iter().map(|v| v.to_owned_message()).collect(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for RowView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RowView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RowView<'a> {
    type Static = RowView<'static>;
}
/// Explicit NULL marker for SQL NULL cells. Distinct from a `Cell` whose
/// `kind` oneof is unset — that indicates a malformed wire message, not NULL.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct Null {
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for Null {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Null").finish()
    }
}
impl Null {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Null";
}
unsafe impl ::buffa::DefaultInstance for Null {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Null> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for Null {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for Null {
    const PROTO_FQN: &'static str = "store.sql.v1.Null";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for Null {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __NULL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.Null",
    to_json: ::buffa::type_registry::any_to_json::<Null>,
    from_json: ::buffa::type_registry::any_from_json::<Null>,
    is_wkt: false,
};
/// Explicit NULL marker for SQL NULL cells. Distinct from a `Cell` whose
/// `kind` oneof is unset — that indicates a malformed wire message, not NULL.
#[derive(Clone, Debug, Default)]
pub struct NullView<'a> {
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> NullView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for NullView<'a> {
    type Owned = Null;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> Null {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        Null {
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for NullView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<NullView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for NullView<'a> {
    type Static = NullView<'static>;
}
/// Ordered list of scalar cells. Used for `List<...>` columns. Elements must
/// all carry the same inner kind (Int64, Float64, Boolean, or Utf8).
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct ListValue {
    /// Field 1: `elements`
    #[serde(
        rename = "elements",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub elements: ::buffa::alloc::vec::Vec<Cell>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for ListValue {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("ListValue").field("elements", &self.elements).finish()
    }
}
impl ListValue {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.ListValue";
}
unsafe impl ::buffa::DefaultInstance for ListValue {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ListValue> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for ListValue {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        for v in &self.elements {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        for v in &self.elements {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
            v.write_to(buf);
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.elements.push(elem);
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.elements.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for ListValue {
    const PROTO_FQN: &'static str = "store.sql.v1.ListValue";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::json_helpers::ProtoElemJson for ListValue {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __LIST_VALUE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.ListValue",
    to_json: ::buffa::type_registry::any_to_json::<ListValue>,
    from_json: ::buffa::type_registry::any_from_json::<ListValue>,
    is_wkt: false,
};
/// Ordered list of scalar cells. Used for `List<...>` columns. Elements must
/// all carry the same inner kind (Int64, Float64, Boolean, or Utf8).
#[derive(Clone, Debug, Default)]
pub struct ListValueView<'a> {
    /// Field 1: `elements`
    pub elements: ::buffa::RepeatedView<'a, CellView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ListValueView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    view.elements.push(CellView::_decode_depth(sub, depth - 1)?);
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for ListValueView<'a> {
    type Owned = ListValue;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> ListValue {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        ListValue {
            elements: self.elements.iter().map(|v| v.to_owned_message()).collect(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for ListValueView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ListValueView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for ListValueView<'a> {
    type Static = ListValueView<'static>;
}
/// Typed scalar for one row cell. Mirrors every column kind supported by
/// `KvSchema`. Servers MUST always set `kind`; clients MUST treat a missing
/// `kind` as a protocol error rather than as NULL.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct Cell {
    #[serde(flatten)]
    pub kind: Option<cell::Kind>,
    #[serde(skip)]
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
    #[doc(hidden)]
    #[serde(skip)]
    pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
impl ::core::fmt::Debug for Cell {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Cell").field("kind", &self.kind).finish()
    }
}
impl Cell {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/store.sql.v1.Cell";
}
unsafe impl ::buffa::DefaultInstance for Cell {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Cell> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for Cell {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    fn compute_size(&self) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        if let ::core::option::Option::Some(ref v) = self.kind {
            match v {
                cell::Kind::NullValue(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                cell::Kind::Int64Value(v) => {
                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
                }
                cell::Kind::Uint64Value(v) => {
                    size += 1u32 + ::buffa::types::uint64_encoded_len(*v) as u32;
                }
                cell::Kind::Float64Value(_x) => {
                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
                }
                cell::Kind::BooleanValue(_x) => {
                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
                }
                cell::Kind::Utf8Value(x) => {
                    size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
                }
                cell::Kind::FixedSizeBinaryValue(x) => {
                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
                }
                cell::Kind::Date32Value(v) => {
                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
                }
                cell::Kind::Date64Value(v) => {
                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
                }
                cell::Kind::TimestampValue(v) => {
                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
                }
                cell::Kind::Decimal128Value(x) => {
                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
                }
                cell::Kind::Decimal256Value(x) => {
                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
                }
                cell::Kind::ListValue(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
            }
        }
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        self.__buffa_cached_size.set(size);
        size
    }
    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if let ::core::option::Option::Some(ref v) = self.kind {
            match v {
                cell::Kind::NullValue(x) => {
                    ::buffa::encoding::Tag::new(
                            1u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                cell::Kind::Int64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            2u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int64(*x, buf);
                }
                cell::Kind::Uint64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            3u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_uint64(*x, buf);
                }
                cell::Kind::Float64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            4u32,
                            ::buffa::encoding::WireType::Fixed64,
                        )
                        .encode(buf);
                    ::buffa::types::encode_double(*x, buf);
                }
                cell::Kind::BooleanValue(x) => {
                    ::buffa::encoding::Tag::new(
                            5u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bool(*x, buf);
                }
                cell::Kind::Utf8Value(x) => {
                    ::buffa::encoding::Tag::new(
                            6u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_string(x, buf);
                }
                cell::Kind::FixedSizeBinaryValue(x) => {
                    ::buffa::encoding::Tag::new(
                            7u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bytes(x, buf);
                }
                cell::Kind::Date32Value(x) => {
                    ::buffa::encoding::Tag::new(
                            8u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int32(*x, buf);
                }
                cell::Kind::Date64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            9u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int64(*x, buf);
                }
                cell::Kind::TimestampValue(x) => {
                    ::buffa::encoding::Tag::new(
                            10u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int64(*x, buf);
                }
                cell::Kind::Decimal128Value(x) => {
                    ::buffa::encoding::Tag::new(
                            11u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bytes(x, buf);
                }
                cell::Kind::Decimal256Value(x) => {
                    ::buffa::encoding::Tag::new(
                            12u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bytes(x, buf);
                }
                cell::Kind::ListValue(x) => {
                    ::buffa::encoding::Tag::new(
                            13u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
            }
        }
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            1u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 1u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                if let ::core::option::Option::Some(
                    cell::Kind::NullValue(ref mut existing),
                ) = self.kind
                {
                    ::buffa::Message::merge_length_delimited(
                        &mut **existing,
                        buf,
                        depth,
                    )?;
                } else {
                    let mut val = ::core::default::Default::default();
                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
                    self.kind = ::core::option::Option::Some(
                        cell::Kind::NullValue(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            2u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Int64Value(::buffa::types::decode_int64(buf)?),
                );
            }
            3u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 3u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Uint64Value(::buffa::types::decode_uint64(buf)?),
                );
            }
            4u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 4u32,
                        expected: 1u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Float64Value(::buffa::types::decode_double(buf)?),
                );
            }
            5u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 5u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::BooleanValue(::buffa::types::decode_bool(buf)?),
                );
            }
            6u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 6u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Utf8Value(::buffa::types::decode_string(buf)?),
                );
            }
            7u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 7u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::FixedSizeBinaryValue(::buffa::types::decode_bytes(buf)?),
                );
            }
            8u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 8u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Date32Value(::buffa::types::decode_int32(buf)?),
                );
            }
            9u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 9u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Date64Value(::buffa::types::decode_int64(buf)?),
                );
            }
            10u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 10u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::TimestampValue(::buffa::types::decode_int64(buf)?),
                );
            }
            11u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 11u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Decimal128Value(::buffa::types::decode_bytes(buf)?),
                );
            }
            12u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 12u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.kind = ::core::option::Option::Some(
                    cell::Kind::Decimal256Value(::buffa::types::decode_bytes(buf)?),
                );
            }
            13u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 13u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                if let ::core::option::Option::Some(
                    cell::Kind::ListValue(ref mut existing),
                ) = self.kind
                {
                    ::buffa::Message::merge_length_delimited(
                        &mut **existing,
                        buf,
                        depth,
                    )?;
                } else {
                    let mut val = ::core::default::Default::default();
                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
                    self.kind = ::core::option::Option::Some(
                        cell::Kind::ListValue(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn cached_size(&self) -> u32 {
        self.__buffa_cached_size.get()
    }
    fn clear(&mut self) {
        self.kind = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for Cell {
    const PROTO_FQN: &'static str = "store.sql.v1.Cell";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl<'de> serde::Deserialize<'de> for Cell {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct _V;
        impl<'de> serde::de::Visitor<'de> for _V {
            type Value = Cell;
            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
                f.write_str("struct Cell")
            }
            #[allow(clippy::field_reassign_with_default)]
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                mut map: A,
            ) -> Result<Cell, A::Error> {
                let mut __oneof_kind: Option<cell::Kind> = None;
                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
                    match key.as_str() {
                        "nullValue" | "null_value" => {
                            let v: Option<Null> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<Null>::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(
                                    cell::Kind::NullValue(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "int64Value" | "int64_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = i64;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<i64, D::Error> {
                                    ::buffa::json_helpers::int64::deserialize(d)
                                }
                            }
                            let v: Option<i64> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Int64Value(v));
                            }
                        }
                        "uint64Value" | "uint64_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = u64;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<u64, D::Error> {
                                    ::buffa::json_helpers::uint64::deserialize(d)
                                }
                            }
                            let v: Option<u64> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Uint64Value(v));
                            }
                        }
                        "float64Value" | "float64_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = f64;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<f64, D::Error> {
                                    ::buffa::json_helpers::double::deserialize(d)
                                }
                            }
                            let v: Option<f64> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Float64Value(v));
                            }
                        }
                        "booleanValue" | "boolean_value" => {
                            let v: Option<bool> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<bool>::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::BooleanValue(v));
                            }
                        }
                        "utf8Value" | "utf8_value" => {
                            let v: Option<::buffa::alloc::string::String> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            ::buffa::alloc::string::String,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Utf8Value(v));
                            }
                        }
                        "fixedSizeBinaryValue" | "fixed_size_binary_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = ::buffa::alloc::vec::Vec<u8>;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<
                                    ::buffa::alloc::vec::Vec<u8>,
                                    D::Error,
                                > {
                                    ::buffa::json_helpers::bytes::deserialize(d)
                                }
                            }
                            let v: Option<::buffa::alloc::vec::Vec<u8>> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::FixedSizeBinaryValue(v));
                            }
                        }
                        "date32Value" | "date32_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = i32;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<i32, D::Error> {
                                    ::buffa::json_helpers::int32::deserialize(d)
                                }
                            }
                            let v: Option<i32> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Date32Value(v));
                            }
                        }
                        "date64Value" | "date64_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = i64;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<i64, D::Error> {
                                    ::buffa::json_helpers::int64::deserialize(d)
                                }
                            }
                            let v: Option<i64> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Date64Value(v));
                            }
                        }
                        "timestampValue" | "timestamp_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = i64;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<i64, D::Error> {
                                    ::buffa::json_helpers::int64::deserialize(d)
                                }
                            }
                            let v: Option<i64> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::TimestampValue(v));
                            }
                        }
                        "decimal128Value" | "decimal128_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = ::buffa::alloc::vec::Vec<u8>;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<
                                    ::buffa::alloc::vec::Vec<u8>,
                                    D::Error,
                                > {
                                    ::buffa::json_helpers::bytes::deserialize(d)
                                }
                            }
                            let v: Option<::buffa::alloc::vec::Vec<u8>> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Decimal128Value(v));
                            }
                        }
                        "decimal256Value" | "decimal256_value" => {
                            struct _DeserSeed;
                            impl<'de> serde::de::DeserializeSeed<'de> for _DeserSeed {
                                type Value = ::buffa::alloc::vec::Vec<u8>;
                                fn deserialize<D: serde::Deserializer<'de>>(
                                    self,
                                    d: D,
                                ) -> ::core::result::Result<
                                    ::buffa::alloc::vec::Vec<u8>,
                                    D::Error,
                                > {
                                    ::buffa::json_helpers::bytes::deserialize(d)
                                }
                            }
                            let v: Option<::buffa::alloc::vec::Vec<u8>> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(_DeserSeed),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(cell::Kind::Decimal256Value(v));
                            }
                        }
                        "listValue" | "list_value" => {
                            let v: Option<ListValue> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            ListValue,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_kind.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'kind'",
                                        ),
                                    );
                                }
                                __oneof_kind = Some(
                                    cell::Kind::ListValue(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        _ => {
                            map.next_value::<serde::de::IgnoredAny>()?;
                        }
                    }
                }
                let mut __r = <Cell as ::core::default::Default>::default();
                __r.kind = __oneof_kind;
                Ok(__r)
            }
        }
        d.deserialize_map(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for Cell {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[doc(hidden)]
pub const __CELL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.sql.v1.Cell",
    to_json: ::buffa::type_registry::any_to_json::<Cell>,
    from_json: ::buffa::type_registry::any_from_json::<Cell>,
    is_wkt: false,
};
/// Typed scalar for one row cell. Mirrors every column kind supported by
/// `KvSchema`. Servers MUST always set `kind`; clients MUST treat a missing
/// `kind` as a protocol error rather than as NULL.
#[derive(Clone, Debug, Default)]
pub struct CellView<'a> {
    pub kind: ::core::option::Option<cell::KindView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> CellView<'a> {
    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
    ///
    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
    /// and by generated sub-message decode arms with `depth - 1`.
    ///
    /// **Not part of the public API.** Named with a leading underscore to
    /// signal that it is for generated-code use only.
    #[doc(hidden)]
    pub fn _decode_depth(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let mut view = Self::default();
        view._merge_into_view(buf, depth)?;
        ::core::result::Result::Ok(view)
    }
    /// Merge fields from `buf` into this view (proto merge semantics).
    ///
    /// Repeated fields append; singular fields last-wins; singular
    /// MESSAGE fields merge recursively. Used by sub-message decode
    /// arms when the same field appears multiple times on the wire.
    ///
    /// **Not part of the public API.**
    #[doc(hidden)]
    pub fn _merge_into_view(
        &mut self,
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        let _ = depth;
        #[allow(unused_variables)]
        let view = self;
        let mut cur: &'a [u8] = buf;
        while !cur.is_empty() {
            let before_tag = cur;
            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
            match tag.field_number() {
                1u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(cell::KindView::NullValue(ref mut existing)) = view.kind
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.kind = Some(
                            cell::KindView::NullValue(
                                ::buffa::alloc::boxed::Box::new(
                                    NullView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                2u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Int64Value(
                            ::buffa::types::decode_int64(&mut cur)?,
                        ),
                    );
                }
                3u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 3u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Uint64Value(
                            ::buffa::types::decode_uint64(&mut cur)?,
                        ),
                    );
                }
                4u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 1u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Float64Value(
                            ::buffa::types::decode_double(&mut cur)?,
                        ),
                    );
                }
                5u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 5u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::BooleanValue(
                            ::buffa::types::decode_bool(&mut cur)?,
                        ),
                    );
                }
                6u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 6u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Utf8Value(::buffa::types::borrow_str(&mut cur)?),
                    );
                }
                7u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 7u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::FixedSizeBinaryValue(
                            ::buffa::types::borrow_bytes(&mut cur)?,
                        ),
                    );
                }
                8u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 8u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Date32Value(
                            ::buffa::types::decode_int32(&mut cur)?,
                        ),
                    );
                }
                9u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 9u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Date64Value(
                            ::buffa::types::decode_int64(&mut cur)?,
                        ),
                    );
                }
                10u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 10u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::TimestampValue(
                            ::buffa::types::decode_int64(&mut cur)?,
                        ),
                    );
                }
                11u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 11u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Decimal128Value(
                            ::buffa::types::borrow_bytes(&mut cur)?,
                        ),
                    );
                }
                12u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 12u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.kind = Some(
                        cell::KindView::Decimal256Value(
                            ::buffa::types::borrow_bytes(&mut cur)?,
                        ),
                    );
                }
                13u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 13u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(cell::KindView::ListValue(ref mut existing)) = view.kind
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.kind = Some(
                            cell::KindView::ListValue(
                                ::buffa::alloc::boxed::Box::new(
                                    ListValueView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
                    let span_len = before_tag.len() - cur.len();
                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
                }
            }
        }
        ::core::result::Result::Ok(())
    }
}
impl<'a> ::buffa::MessageView<'a> for CellView<'a> {
    type Owned = Cell;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
    }
    fn decode_view_with_limit(
        buf: &'a [u8],
        depth: u32,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        Self::_decode_depth(buf, depth)
    }
    /// Convert this view to the owned message type.
    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
    fn to_owned_message(&self) -> Cell {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        Cell {
            kind: self
                .kind
                .as_ref()
                .map(|v| match v {
                    cell::KindView::NullValue(v) => {
                        cell::Kind::NullValue(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    cell::KindView::Int64Value(v) => cell::Kind::Int64Value(*v),
                    cell::KindView::Uint64Value(v) => cell::Kind::Uint64Value(*v),
                    cell::KindView::Float64Value(v) => cell::Kind::Float64Value(*v),
                    cell::KindView::BooleanValue(v) => cell::Kind::BooleanValue(*v),
                    cell::KindView::Utf8Value(v) => cell::Kind::Utf8Value(v.to_string()),
                    cell::KindView::FixedSizeBinaryValue(v) => {
                        cell::Kind::FixedSizeBinaryValue((v).to_vec())
                    }
                    cell::KindView::Date32Value(v) => cell::Kind::Date32Value(*v),
                    cell::KindView::Date64Value(v) => cell::Kind::Date64Value(*v),
                    cell::KindView::TimestampValue(v) => cell::Kind::TimestampValue(*v),
                    cell::KindView::Decimal128Value(v) => {
                        cell::Kind::Decimal128Value((v).to_vec())
                    }
                    cell::KindView::Decimal256Value(v) => {
                        cell::Kind::Decimal256Value((v).to_vec())
                    }
                    cell::KindView::ListValue(v) => {
                        cell::Kind::ListValue(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                }),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for CellView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<CellView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for CellView<'a> {
    type Static = CellView<'static>;
}
pub mod cell {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, PartialEq, Debug)]
    pub enum Kind {
        NullValue(::buffa::alloc::boxed::Box<super::Null>),
        Int64Value(i64),
        Uint64Value(u64),
        Float64Value(f64),
        BooleanValue(bool),
        Utf8Value(::buffa::alloc::string::String),
        FixedSizeBinaryValue(::buffa::alloc::vec::Vec<u8>),
        Date32Value(i32),
        Date64Value(i64),
        TimestampValue(i64),
        Decimal128Value(::buffa::alloc::vec::Vec<u8>),
        Decimal256Value(::buffa::alloc::vec::Vec<u8>),
        ListValue(::buffa::alloc::boxed::Box<super::ListValue>),
    }
    impl ::buffa::Oneof for Kind {}
    impl From<super::Null> for Kind {
        fn from(v: super::Null) -> Self {
            Self::NullValue(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::Null> for ::core::option::Option<Kind> {
        fn from(v: super::Null) -> Self {
            Self::Some(Kind::from(v))
        }
    }
    impl From<super::ListValue> for Kind {
        fn from(v: super::ListValue) -> Self {
            Self::ListValue(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::ListValue> for ::core::option::Option<Kind> {
        fn from(v: super::ListValue) -> Self {
            Self::Some(Kind::from(v))
        }
    }
    impl serde::Serialize for Kind {
        fn serialize<S: serde::Serializer>(
            &self,
            s: S,
        ) -> ::core::result::Result<S::Ok, S::Error> {
            use serde::ser::SerializeMap;
            let mut map = s.serialize_map(Some(1))?;
            match self {
                Kind::NullValue(v) => {
                    map.serialize_entry("nullValue", v)?;
                }
                Kind::Int64Value(v) => {
                    struct _W<'a>(&'a i64);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::int64::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("int64Value", &_W(v))?;
                }
                Kind::Uint64Value(v) => {
                    struct _W<'a>(&'a u64);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::uint64::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("uint64Value", &_W(v))?;
                }
                Kind::Float64Value(v) => {
                    struct _W<'a>(&'a f64);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::double::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("float64Value", &_W(v))?;
                }
                Kind::BooleanValue(v) => {
                    map.serialize_entry("booleanValue", v)?;
                }
                Kind::Utf8Value(v) => {
                    map.serialize_entry("utf8Value", v)?;
                }
                Kind::FixedSizeBinaryValue(v) => {
                    struct _W<'a>(&'a ::buffa::alloc::vec::Vec<u8>);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::bytes::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("fixedSizeBinaryValue", &_W(v))?;
                }
                Kind::Date32Value(v) => {
                    struct _W<'a>(&'a i32);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::int32::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("date32Value", &_W(v))?;
                }
                Kind::Date64Value(v) => {
                    struct _W<'a>(&'a i64);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::int64::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("date64Value", &_W(v))?;
                }
                Kind::TimestampValue(v) => {
                    struct _W<'a>(&'a i64);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::int64::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("timestampValue", &_W(v))?;
                }
                Kind::Decimal128Value(v) => {
                    struct _W<'a>(&'a ::buffa::alloc::vec::Vec<u8>);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::bytes::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("decimal128Value", &_W(v))?;
                }
                Kind::Decimal256Value(v) => {
                    struct _W<'a>(&'a ::buffa::alloc::vec::Vec<u8>);
                    impl serde::Serialize for _W<'_> {
                        fn serialize<S2: serde::Serializer>(
                            &self,
                            s: S2,
                        ) -> ::core::result::Result<S2::Ok, S2::Error> {
                            ::buffa::json_helpers::bytes::serialize(self.0, s)
                        }
                    }
                    map.serialize_entry("decimal256Value", &_W(v))?;
                }
                Kind::ListValue(v) => {
                    map.serialize_entry("listValue", v)?;
                }
            }
            map.end()
        }
    }
    #[derive(Clone, Debug)]
    pub enum KindView<'a> {
        NullValue(::buffa::alloc::boxed::Box<super::NullView<'a>>),
        Int64Value(i64),
        Uint64Value(u64),
        Float64Value(f64),
        BooleanValue(bool),
        Utf8Value(&'a str),
        FixedSizeBinaryValue(&'a [u8]),
        Date32Value(i32),
        Date64Value(i64),
        TimestampValue(i64),
        Decimal128Value(&'a [u8]),
        Decimal256Value(&'a [u8]),
        ListValue(::buffa::alloc::boxed::Box<super::ListValueView<'a>>),
    }
}

/// Full service name for this service.
pub const SERVICE_SERVICE_NAME: &str = "store.sql.v1.Service";
/// Streaming SQL predicate service over a server-side `KvSchema`.
/// The server registers a fixed set of SQL tables at startup (schema lives on
/// the server, not the wire). Each RPC names one of those tables.
///
/// # Implementing handlers
///
/// Handlers receive requests as `OwnedView<FooView<'static>>`, which gives
/// zero-copy borrowed access to fields (e.g. `request.name` is a `&str`
/// into the decoded buffer). The view can be held across `.await` points.
///
/// Implement methods with plain `async fn`; the returned future satisfies
/// the `Send` bound automatically. See the
/// [buffa user guide](https://github.com/anthropics/buffa/blob/main/docs/guide.md#ownedview-in-async-trait-implementations)
/// for zero-copy access patterns and when `to_owned_message()` is needed.
#[allow(clippy::type_complexity)]
pub trait Service: Send + Sync + 'static {
    /// Re-run a SQL WHERE predicate against every incoming batch that touches
    /// `table`'s primary-key codec family. Emits one `SubscribeResponse` per
    /// matched batch containing just the rows that satisfied the predicate.
    fn subscribe(
        &self,
        ctx: ::connectrpc::Context,
        request: ::buffa::view::OwnedView<SubscribeRequestView<'static>>,
    ) -> impl ::std::future::Future<
        Output = Result<
            (
                ::std::pin::Pin<
                    Box<
                        dyn ::futures::Stream<
                            Item = Result<SubscribeResponse, ::connectrpc::ConnectError>,
                        > + Send,
                    >,
                >,
                ::connectrpc::Context,
            ),
            ::connectrpc::ConnectError,
        >,
    > + Send;
    /// Ad-hoc unary SQL against the server-side session. Useful for inspecting
    /// the current table state alongside the live subscription.
    fn query(
        &self,
        ctx: ::connectrpc::Context,
        request: ::buffa::view::OwnedView<QueryRequestView<'static>>,
    ) -> impl ::std::future::Future<
        Output = Result<
            (QueryResponse, ::connectrpc::Context),
            ::connectrpc::ConnectError,
        >,
    > + Send;
    /// Describe every registered table. Carries KV-specific metadata
    /// (primary-key order, secondary indexes with their layout + cover columns)
    /// that DataFusion's `information_schema` doesn't surface.
    fn tables(
        &self,
        ctx: ::connectrpc::Context,
        request: ::buffa::view::OwnedView<TablesRequestView<'static>>,
    ) -> impl ::std::future::Future<
        Output = Result<
            (TablesResponse, ::connectrpc::Context),
            ::connectrpc::ConnectError,
        >,
    > + Send;
}
/// Extension trait for registering a service implementation with a Router.
///
/// This trait is automatically implemented for all types that implement the service trait.
///
/// # Example
///
/// ```rust,ignore
/// use std::sync::Arc;
///
/// let service = Arc::new(MyServiceImpl);
/// let router = service.register(Router::new());
/// ```
pub trait ServiceExt: Service {
    /// Register this service implementation with a Router.
    ///
    /// Takes ownership of the `Arc<Self>` and returns a new Router with
    /// this service's methods registered.
    fn register(
        self: ::std::sync::Arc<Self>,
        router: ::connectrpc::Router,
    ) -> ::connectrpc::Router;
}
impl<S: Service> ServiceExt for S {
    fn register(
        self: ::std::sync::Arc<Self>,
        router: ::connectrpc::Router,
    ) -> ::connectrpc::Router {
        router
            .route_view_server_stream(
                SERVICE_SERVICE_NAME,
                "Subscribe",
                ::connectrpc::view_streaming_handler_fn({
                    let svc = ::std::sync::Arc::clone(&self);
                    move |ctx, req| {
                        let svc = ::std::sync::Arc::clone(&svc);
                        async move { svc.subscribe(ctx, req).await }
                    }
                }),
            )
            .route_view(
                SERVICE_SERVICE_NAME,
                "Query",
                {
                    let svc = ::std::sync::Arc::clone(&self);
                    ::connectrpc::view_handler_fn(move |ctx, req| {
                        let svc = ::std::sync::Arc::clone(&svc);
                        async move { svc.query(ctx, req).await }
                    })
                },
            )
            .route_view(
                SERVICE_SERVICE_NAME,
                "Tables",
                {
                    let svc = ::std::sync::Arc::clone(&self);
                    ::connectrpc::view_handler_fn(move |ctx, req| {
                        let svc = ::std::sync::Arc::clone(&svc);
                        async move { svc.tables(ctx, req).await }
                    })
                },
            )
    }
}
/// Monomorphic dispatcher for `Service`.
///
/// 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.
///
/// # Example
///
/// ```rust,ignore
/// use connectrpc::ConnectRpcService;
///
/// let server = ServiceServer::new(MyImpl);
/// let service = ConnectRpcService::new(server);
/// // hand `service` to axum/hyper as a fallback_service
/// ```
pub struct ServiceServer<T> {
    inner: ::std::sync::Arc<T>,
}
impl<T: Service> ServiceServer<T> {
    /// Wrap a service implementation in a monomorphic dispatcher.
    pub fn new(service: T) -> Self {
        Self {
            inner: ::std::sync::Arc::new(service),
        }
    }
    /// Wrap an already-`Arc`'d service implementation.
    pub fn from_arc(inner: ::std::sync::Arc<T>) -> Self {
        Self { inner }
    }
}
impl<T> Clone for ServiceServer<T> {
    fn clone(&self) -> Self {
        Self {
            inner: ::std::sync::Arc::clone(&self.inner),
        }
    }
}
impl<T: Service> ::connectrpc::Dispatcher for ServiceServer<T> {
    #[inline]
    fn lookup(
        &self,
        path: &str,
    ) -> Option<::connectrpc::dispatcher::codegen::MethodDescriptor> {
        let method = path.strip_prefix("store.sql.v1.Service/")?;
        match method {
            "Subscribe" => {
                Some(
                    ::connectrpc::dispatcher::codegen::MethodDescriptor::server_streaming(),
                )
            }
            "Query" => {
                Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false))
            }
            "Tables" => {
                Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false))
            }
            _ => None,
        }
    }
    fn call_unary(
        &self,
        path: &str,
        ctx: ::connectrpc::Context,
        request: ::buffa::bytes::Bytes,
        format: ::connectrpc::CodecFormat,
    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
        };
        let _ = (&ctx, &request, &format);
        match method {
            "Query" => {
                let svc = ::std::sync::Arc::clone(&self.inner);
                Box::pin(async move {
                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
                        QueryRequestView,
                    >(request, format)?;
                    let (res, ctx) = svc.query(ctx, req).await?;
                    let bytes = ::connectrpc::dispatcher::codegen::encode_response(
                        &res,
                        format,
                    )?;
                    Ok((bytes, ctx))
                })
            }
            "Tables" => {
                let svc = ::std::sync::Arc::clone(&self.inner);
                Box::pin(async move {
                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
                        TablesRequestView,
                    >(request, format)?;
                    let (res, ctx) = svc.tables(ctx, req).await?;
                    let bytes = ::connectrpc::dispatcher::codegen::encode_response(
                        &res,
                        format,
                    )?;
                    Ok((bytes, ctx))
                })
            }
            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
        }
    }
    fn call_server_streaming(
        &self,
        path: &str,
        ctx: ::connectrpc::Context,
        request: ::buffa::bytes::Bytes,
        format: ::connectrpc::CodecFormat,
    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
        };
        let _ = (&ctx, &request, &format);
        match method {
            "Subscribe" => {
                let svc = ::std::sync::Arc::clone(&self.inner);
                Box::pin(async move {
                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
                        SubscribeRequestView,
                    >(request, format)?;
                    let (resp_stream, ctx) = svc.subscribe(ctx, req).await?;
                    Ok((
                        ::connectrpc::dispatcher::codegen::encode_response_stream(
                            resp_stream,
                            format,
                        ),
                        ctx,
                    ))
                })
            }
            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
        }
    }
    fn call_client_streaming(
        &self,
        path: &str,
        ctx: ::connectrpc::Context,
        requests: ::connectrpc::dispatcher::codegen::RequestStream,
        format: ::connectrpc::CodecFormat,
    ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
        };
        let _ = (&ctx, &requests, &format);
        match method {
            _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
        }
    }
    fn call_bidi_streaming(
        &self,
        path: &str,
        ctx: ::connectrpc::Context,
        requests: ::connectrpc::dispatcher::codegen::RequestStream,
        format: ::connectrpc::CodecFormat,
    ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
        let Some(method) = path.strip_prefix("store.sql.v1.Service/") else {
            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
        };
        let _ = (&ctx, &requests, &format);
        match method {
            _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
        }
    }
}
/// Client for this service.
///
/// Generic over `T: ClientTransport`. For **gRPC** (HTTP/2), use
/// `Http2Connection` — it has honest `poll_ready` and composes with
/// `tower::balance` for multi-connection load balancing. For **Connect
/// over HTTP/1.1** (or unknown protocol), use `HttpClient`.
///
/// # Example (gRPC / HTTP/2)
///
/// ```rust,ignore
/// use connectrpc::client::{Http2Connection, ClientConfig};
/// use connectrpc::Protocol;
///
/// let uri: http::Uri = "http://localhost:8080".parse()?;
/// let conn = Http2Connection::connect_plaintext(uri.clone()).await?.shared(1024);
/// let config = ClientConfig::new(uri).protocol(Protocol::Grpc);
///
/// let client = ServiceClient::new(conn, config);
/// let response = client.subscribe(request).await?;
/// ```
///
/// # Example (Connect / HTTP/1.1 or ALPN)
///
/// ```rust,ignore
/// use connectrpc::client::{HttpClient, ClientConfig};
///
/// let http = HttpClient::plaintext();  // cleartext http:// only
/// let config = ClientConfig::new("http://localhost:8080".parse()?);
///
/// let client = ServiceClient::new(http, config);
/// let response = client.subscribe(request).await?;
/// ```
///
/// # Working with the response
///
/// Unary calls return [`UnaryResponse<OwnedView<FooView>>`](::connectrpc::client::UnaryResponse).
/// The `OwnedView` derefs to the view, so field access is zero-copy:
///
/// ```rust,ignore
/// let resp = client.subscribe(request).await?.into_view();
/// let name: &str = resp.name;  // borrow into the response buffer
/// ```
///
/// If you need the owned struct (e.g. to store or pass by value), use
/// [`into_owned()`](::connectrpc::client::UnaryResponse::into_owned):
///
/// ```rust,ignore
/// let owned = client.subscribe(request).await?.into_owned();
/// ```
#[derive(Clone)]
pub struct ServiceClient<T> {
    transport: T,
    config: ::connectrpc::client::ClientConfig,
}
impl<T> ServiceClient<T>
where
    T: ::connectrpc::client::ClientTransport,
    <T::ResponseBody as ::http_body::Body>::Error: ::std::fmt::Display,
{
    /// Create a new client with the given transport and configuration.
    pub fn new(transport: T, config: ::connectrpc::client::ClientConfig) -> Self {
        Self { transport, config }
    }
    /// Get the client configuration.
    pub fn config(&self) -> &::connectrpc::client::ClientConfig {
        &self.config
    }
    /// Get a mutable reference to the client configuration.
    pub fn config_mut(&mut self) -> &mut ::connectrpc::client::ClientConfig {
        &mut self.config
    }
    /// Call the Subscribe RPC. Sends a request to /store.sql.v1.Service/Subscribe.
    pub async fn subscribe(
        &self,
        request: SubscribeRequest,
    ) -> Result<
        ::connectrpc::client::ServerStream<
            T::ResponseBody,
            SubscribeResponseView<'static>,
        >,
        ::connectrpc::ConnectError,
    > {
        self.subscribe_with_options(
                request,
                ::connectrpc::client::CallOptions::default(),
            )
            .await
    }
    /// Call the Subscribe RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
    pub async fn subscribe_with_options(
        &self,
        request: SubscribeRequest,
        options: ::connectrpc::client::CallOptions,
    ) -> Result<
        ::connectrpc::client::ServerStream<
            T::ResponseBody,
            SubscribeResponseView<'static>,
        >,
        ::connectrpc::ConnectError,
    > {
        ::connectrpc::client::call_server_stream(
                &self.transport,
                &self.config,
                SERVICE_SERVICE_NAME,
                "Subscribe",
                request,
                options,
            )
            .await
    }
    /// Call the Query RPC. Sends a request to /store.sql.v1.Service/Query.
    pub async fn query(
        &self,
        request: QueryRequest,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<QueryResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        self.query_with_options(request, ::connectrpc::client::CallOptions::default())
            .await
    }
    /// Call the Query RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
    pub async fn query_with_options(
        &self,
        request: QueryRequest,
        options: ::connectrpc::client::CallOptions,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<QueryResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        ::connectrpc::client::call_unary(
                &self.transport,
                &self.config,
                SERVICE_SERVICE_NAME,
                "Query",
                request,
                options,
            )
            .await
    }
    /// Call the Tables RPC. Sends a request to /store.sql.v1.Service/Tables.
    pub async fn tables(
        &self,
        request: TablesRequest,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<TablesResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        self.tables_with_options(request, ::connectrpc::client::CallOptions::default())
            .await
    }
    /// Call the Tables RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
    pub async fn tables_with_options(
        &self,
        request: TablesRequest,
        options: ::connectrpc::client::CallOptions,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<TablesResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        ::connectrpc::client::call_unary(
                &self.transport,
                &self.config,
                SERVICE_SERVICE_NAME,
                "Tables",
                request,
                options,
            )
            .await
    }
}
