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

/// Default when `RangeRequest.mode` is unset (proto3 implicit enum).
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum TraversalMode {
    TRAVERSAL_MODE_FORWARD = 0i32,
    TRAVERSAL_MODE_REVERSE = 1i32,
}
impl ::core::default::Default for TraversalMode {
    fn default() -> Self {
        Self::TRAVERSAL_MODE_FORWARD
    }
}
impl ::serde::Serialize for TraversalMode {
    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 TraversalMode {
    fn deserialize<D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        struct _V;
        impl ::serde::de::Visitor<'_> for _V {
            type Value = TraversalMode;
            fn expecting(
                &self,
                f: &mut ::core::fmt::Formatter<'_>,
            ) -> ::core::fmt::Result {
                f.write_str(
                    concat!("a string, integer, or null for ", stringify!(TraversalMode)),
                )
            }
            fn visit_str<E: ::serde::de::Error>(
                self,
                v: &str,
            ) -> ::core::result::Result<TraversalMode, E> {
                <TraversalMode 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<TraversalMode, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <TraversalMode 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<TraversalMode, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <TraversalMode 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<TraversalMode, E> {
                ::core::result::Result::Ok(::core::default::Default::default())
            }
        }
        d.deserialize_any(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for TraversalMode {
    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 TraversalMode {
    fn from_i32(value: i32) -> ::core::option::Option<Self> {
        match value {
            0i32 => ::core::option::Option::Some(Self::TRAVERSAL_MODE_FORWARD),
            1i32 => ::core::option::Option::Some(Self::TRAVERSAL_MODE_REVERSE),
            _ => ::core::option::Option::None,
        }
    }
    fn to_i32(&self) -> i32 {
        *self as i32
    }
    fn proto_name(&self) -> &'static str {
        match self {
            Self::TRAVERSAL_MODE_FORWARD => "TRAVERSAL_MODE_FORWARD",
            Self::TRAVERSAL_MODE_REVERSE => "TRAVERSAL_MODE_REVERSE",
        }
    }
    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
        match name {
            "TRAVERSAL_MODE_FORWARD" => {
                ::core::option::Option::Some(Self::TRAVERSAL_MODE_FORWARD)
            }
            "TRAVERSAL_MODE_REVERSE" => {
                ::core::option::Option::Some(Self::TRAVERSAL_MODE_REVERSE)
            }
            _ => ::core::option::Option::None,
        }
    }
}
/// --- Range-reduction DSL (`Reduce`); mirrors `exoware_sdk::kv_codec` ---
///
/// Scalar type of a field extracted from a stored key or value.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum KvFieldKind {
    KV_FIELD_KIND_INT64 = 0i32,
    KV_FIELD_KIND_UINT64 = 1i32,
    KV_FIELD_KIND_FLOAT64 = 2i32,
    KV_FIELD_KIND_BOOLEAN = 3i32,
    KV_FIELD_KIND_UTF8 = 4i32,
    /// Days since Unix epoch.
    KV_FIELD_KIND_DATE32 = 5i32,
    /// Milliseconds since Unix epoch.
    KV_FIELD_KIND_DATE64 = 6i32,
    /// Microseconds since Unix epoch.
    KV_FIELD_KIND_TIMESTAMP = 7i32,
    /// 16-byte little-endian decimal (Arrow Decimal128).
    KV_FIELD_KIND_DECIMAL128 = 8i32,
    /// Fixed-width binary; length given by `fixed_size_binary_len`.
    KV_FIELD_KIND_FIXED_SIZE_BINARY = 9i32,
    /// 32-byte little-endian decimal (Arrow Decimal256).
    KV_FIELD_KIND_DECIMAL256 = 10i32,
}
impl ::core::default::Default for KvFieldKind {
    fn default() -> Self {
        Self::KV_FIELD_KIND_INT64
    }
}
impl ::serde::Serialize for KvFieldKind {
    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 KvFieldKind {
    fn deserialize<D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        struct _V;
        impl ::serde::de::Visitor<'_> for _V {
            type Value = KvFieldKind;
            fn expecting(
                &self,
                f: &mut ::core::fmt::Formatter<'_>,
            ) -> ::core::fmt::Result {
                f.write_str(
                    concat!("a string, integer, or null for ", stringify!(KvFieldKind)),
                )
            }
            fn visit_str<E: ::serde::de::Error>(
                self,
                v: &str,
            ) -> ::core::result::Result<KvFieldKind, E> {
                <KvFieldKind 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<KvFieldKind, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <KvFieldKind 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<KvFieldKind, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <KvFieldKind 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<KvFieldKind, E> {
                ::core::result::Result::Ok(::core::default::Default::default())
            }
        }
        d.deserialize_any(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for KvFieldKind {
    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 KvFieldKind {
    fn from_i32(value: i32) -> ::core::option::Option<Self> {
        match value {
            0i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_INT64),
            1i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_UINT64),
            2i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_FLOAT64),
            3i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_BOOLEAN),
            4i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_UTF8),
            5i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_DATE32),
            6i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_DATE64),
            7i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_TIMESTAMP),
            8i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_DECIMAL128),
            9i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_FIXED_SIZE_BINARY),
            10i32 => ::core::option::Option::Some(Self::KV_FIELD_KIND_DECIMAL256),
            _ => ::core::option::Option::None,
        }
    }
    fn to_i32(&self) -> i32 {
        *self as i32
    }
    fn proto_name(&self) -> &'static str {
        match self {
            Self::KV_FIELD_KIND_INT64 => "KV_FIELD_KIND_INT64",
            Self::KV_FIELD_KIND_UINT64 => "KV_FIELD_KIND_UINT64",
            Self::KV_FIELD_KIND_FLOAT64 => "KV_FIELD_KIND_FLOAT64",
            Self::KV_FIELD_KIND_BOOLEAN => "KV_FIELD_KIND_BOOLEAN",
            Self::KV_FIELD_KIND_UTF8 => "KV_FIELD_KIND_UTF8",
            Self::KV_FIELD_KIND_DATE32 => "KV_FIELD_KIND_DATE32",
            Self::KV_FIELD_KIND_DATE64 => "KV_FIELD_KIND_DATE64",
            Self::KV_FIELD_KIND_TIMESTAMP => "KV_FIELD_KIND_TIMESTAMP",
            Self::KV_FIELD_KIND_DECIMAL128 => "KV_FIELD_KIND_DECIMAL128",
            Self::KV_FIELD_KIND_FIXED_SIZE_BINARY => "KV_FIELD_KIND_FIXED_SIZE_BINARY",
            Self::KV_FIELD_KIND_DECIMAL256 => "KV_FIELD_KIND_DECIMAL256",
        }
    }
    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
        match name {
            "KV_FIELD_KIND_INT64" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_INT64)
            }
            "KV_FIELD_KIND_UINT64" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_UINT64)
            }
            "KV_FIELD_KIND_FLOAT64" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_FLOAT64)
            }
            "KV_FIELD_KIND_BOOLEAN" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_BOOLEAN)
            }
            "KV_FIELD_KIND_UTF8" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_UTF8)
            }
            "KV_FIELD_KIND_DATE32" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_DATE32)
            }
            "KV_FIELD_KIND_DATE64" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_DATE64)
            }
            "KV_FIELD_KIND_TIMESTAMP" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_TIMESTAMP)
            }
            "KV_FIELD_KIND_DECIMAL128" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_DECIMAL128)
            }
            "KV_FIELD_KIND_FIXED_SIZE_BINARY" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_FIXED_SIZE_BINARY)
            }
            "KV_FIELD_KIND_DECIMAL256" => {
                ::core::option::Option::Some(Self::KV_FIELD_KIND_DECIMAL256)
            }
            _ => ::core::option::Option::None,
        }
    }
}
/// Aggregation operation applied by a reducer.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum RangeReduceOp {
    /// Count every row (ignores `expr`; `expr` must not be set).
    RANGE_REDUCE_OP_COUNT_ALL = 0i32,
    /// Count rows where `expr` evaluates to a non-NULL value.
    RANGE_REDUCE_OP_COUNT_FIELD = 1i32,
    /// Sum of `expr` across rows (numeric types only).
    RANGE_REDUCE_OP_SUM_FIELD = 2i32,
    /// Minimum value of `expr` across rows.
    RANGE_REDUCE_OP_MIN_FIELD = 3i32,
    /// Maximum value of `expr` across rows.
    RANGE_REDUCE_OP_MAX_FIELD = 4i32,
}
impl ::core::default::Default for RangeReduceOp {
    fn default() -> Self {
        Self::RANGE_REDUCE_OP_COUNT_ALL
    }
}
impl ::serde::Serialize for RangeReduceOp {
    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 RangeReduceOp {
    fn deserialize<D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        struct _V;
        impl ::serde::de::Visitor<'_> for _V {
            type Value = RangeReduceOp;
            fn expecting(
                &self,
                f: &mut ::core::fmt::Formatter<'_>,
            ) -> ::core::fmt::Result {
                f.write_str(
                    concat!("a string, integer, or null for ", stringify!(RangeReduceOp)),
                )
            }
            fn visit_str<E: ::serde::de::Error>(
                self,
                v: &str,
            ) -> ::core::result::Result<RangeReduceOp, E> {
                <RangeReduceOp 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<RangeReduceOp, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <RangeReduceOp 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<RangeReduceOp, E> {
                let v32 = i32::try_from(v)
                    .map_err(|_| {
                        ::serde::de::Error::custom(
                            ::buffa::alloc::format!("enum value {} out of i32 range", v),
                        )
                    })?;
                <RangeReduceOp 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<RangeReduceOp, E> {
                ::core::result::Result::Ok(::core::default::Default::default())
            }
        }
        d.deserialize_any(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for RangeReduceOp {
    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 RangeReduceOp {
    fn from_i32(value: i32) -> ::core::option::Option<Self> {
        match value {
            0i32 => ::core::option::Option::Some(Self::RANGE_REDUCE_OP_COUNT_ALL),
            1i32 => ::core::option::Option::Some(Self::RANGE_REDUCE_OP_COUNT_FIELD),
            2i32 => ::core::option::Option::Some(Self::RANGE_REDUCE_OP_SUM_FIELD),
            3i32 => ::core::option::Option::Some(Self::RANGE_REDUCE_OP_MIN_FIELD),
            4i32 => ::core::option::Option::Some(Self::RANGE_REDUCE_OP_MAX_FIELD),
            _ => ::core::option::Option::None,
        }
    }
    fn to_i32(&self) -> i32 {
        *self as i32
    }
    fn proto_name(&self) -> &'static str {
        match self {
            Self::RANGE_REDUCE_OP_COUNT_ALL => "RANGE_REDUCE_OP_COUNT_ALL",
            Self::RANGE_REDUCE_OP_COUNT_FIELD => "RANGE_REDUCE_OP_COUNT_FIELD",
            Self::RANGE_REDUCE_OP_SUM_FIELD => "RANGE_REDUCE_OP_SUM_FIELD",
            Self::RANGE_REDUCE_OP_MIN_FIELD => "RANGE_REDUCE_OP_MIN_FIELD",
            Self::RANGE_REDUCE_OP_MAX_FIELD => "RANGE_REDUCE_OP_MAX_FIELD",
        }
    }
    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
        match name {
            "RANGE_REDUCE_OP_COUNT_ALL" => {
                ::core::option::Option::Some(Self::RANGE_REDUCE_OP_COUNT_ALL)
            }
            "RANGE_REDUCE_OP_COUNT_FIELD" => {
                ::core::option::Option::Some(Self::RANGE_REDUCE_OP_COUNT_FIELD)
            }
            "RANGE_REDUCE_OP_SUM_FIELD" => {
                ::core::option::Option::Some(Self::RANGE_REDUCE_OP_SUM_FIELD)
            }
            "RANGE_REDUCE_OP_MIN_FIELD" => {
                ::core::option::Option::Some(Self::RANGE_REDUCE_OP_MIN_FIELD)
            }
            "RANGE_REDUCE_OP_MAX_FIELD" => {
                ::core::option::Option::Some(Self::RANGE_REDUCE_OP_MAX_FIELD)
            }
            _ => ::core::option::Option::None,
        }
    }
}
/// --- Query wire types ---
///
/// Visible store sequence number plus read counters for query RPCs. On success, carried in unary
/// response metadata (`Get` / `Reduce`) or streaming trailers (`Range` / `GetMany`); also attached as a `google.rpc` error
/// detail when the RPC fails (same message shape in both cases).
///
/// The reference RocksDB engine reports `read_bytes`: the sum of key length plus value length for
/// each entry read by the RPC (for `Get`, the looked-up key plus returned value if any).
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct Detail {
    /// 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,
    /// Field 2: `read_stats`
    #[serde(
        rename = "readStats",
        alias = "read_stats",
        with = "::buffa::json_helpers::proto_map",
        skip_serializing_if = "::buffa::__private::HashMap::is_empty"
    )]
    pub read_stats: ::buffa::__private::HashMap<::buffa::alloc::string::String, 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 Detail {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Detail")
            .field("sequence_number", &self.sequence_number)
            .field("read_stats", &self.read_stats)
            .finish()
    }
}
impl Detail {
    /// 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.query.v1.Detail";
}
unsafe impl ::buffa::DefaultInstance for Detail {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Detail> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for Detail {
    /// 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 (k, v) in &self.read_stats {
            let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
                + 1u32 + ::buffa::types::uint64_encoded_len(*v) as u32;
            size
                += 1u32 + ::buffa::encoding::varint_len(entry_size as u64) as u32
                    + entry_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 (k, v) in &self.read_stats {
            let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
                + 1u32 + ::buffa::types::uint64_encoded_len(*v) as u32;
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(entry_size as u64, buf);
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_string(k, buf);
            ::buffa::encoding::Tag::new(2u32, ::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::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,
                    });
                }
                let entry_len = ::buffa::encoding::decode_varint(buf)?;
                let entry_len = usize::try_from(entry_len)
                    .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
                if buf.remaining() < entry_len {
                    return ::core::result::Result::Err(
                        ::buffa::DecodeError::UnexpectedEof,
                    );
                }
                let entry_limit = buf.remaining() - entry_len;
                let mut key = ::core::default::Default::default();
                let mut val = ::core::default::Default::default();
                while buf.remaining() > entry_limit {
                    let entry_tag = ::buffa::encoding::Tag::decode(buf)?;
                    match entry_tag.field_number() {
                        1 => {
                            if entry_tag.wire_type()
                                != ::buffa::encoding::WireType::LengthDelimited
                            {
                                return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                                    field_number: entry_tag.field_number(),
                                    expected: 2u8,
                                    actual: entry_tag.wire_type() as u8,
                                });
                            }
                            key = ::buffa::types::decode_string(buf)?;
                        }
                        2 => {
                            if entry_tag.wire_type()
                                != ::buffa::encoding::WireType::Varint
                            {
                                return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                                    field_number: entry_tag.field_number(),
                                    expected: 0u8,
                                    actual: entry_tag.wire_type() as u8,
                                });
                            }
                            val = ::buffa::types::decode_uint64(buf)?;
                        }
                        _ => {
                            ::buffa::encoding::skip_field_depth(entry_tag, buf, depth)?;
                        }
                    }
                }
                if buf.remaining() != entry_limit {
                    let remaining = buf.remaining();
                    if remaining > entry_limit {
                        buf.advance(remaining - entry_limit);
                    } else {
                        return ::core::result::Result::Err(
                            ::buffa::DecodeError::UnexpectedEof,
                        );
                    }
                }
                self.read_stats.insert(key, 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.sequence_number = 0u64;
        self.read_stats.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for Detail {
    const PROTO_FQN: &'static str = "store.query.v1.Detail";
    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 Detail {
    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 __DETAIL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.Detail",
    to_json: ::buffa::type_registry::any_to_json::<Detail>,
    from_json: ::buffa::type_registry::any_from_json::<Detail>,
    is_wkt: false,
};
/// --- Query wire types ---
///
/// Visible store sequence number plus read counters for query RPCs. On success, carried in unary
/// response metadata (`Get` / `Reduce`) or streaming trailers (`Range` / `GetMany`); also attached as a `google.rpc` error
/// detail when the RPC fails (same message shape in both cases).
///
/// The reference RocksDB engine reports `read_bytes`: the sum of key length plus value length for
/// each entry read by the RPC (for `Get`, the looked-up key plus returned value if any).
#[derive(Clone, Debug, Default)]
pub struct DetailView<'a> {
    /// Field 1: `sequence_number`
    pub sequence_number: u64,
    /// Field 2: `read_stats` (map)
    pub read_stats: ::buffa::MapView<'a, &'a str, u64>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> DetailView<'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,
                        });
                    }
                    let entry_bytes = ::buffa::types::borrow_bytes(&mut cur)?;
                    let mut entry_cur: &'a [u8] = entry_bytes;
                    let mut key = "";
                    let mut val = ::core::default::Default::default();
                    while !entry_cur.is_empty() {
                        let entry_tag = ::buffa::encoding::Tag::decode(&mut entry_cur)?;
                        match entry_tag.field_number() {
                            1 => {
                                if entry_tag.wire_type()
                                    != ::buffa::encoding::WireType::LengthDelimited
                                {
                                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                                        field_number: entry_tag.field_number(),
                                        expected: 2u8,
                                        actual: entry_tag.wire_type() as u8,
                                    });
                                }
                                key = ::buffa::types::borrow_str(&mut entry_cur)?;
                            }
                            2 => {
                                if entry_tag.wire_type()
                                    != ::buffa::encoding::WireType::Varint
                                {
                                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                                        field_number: entry_tag.field_number(),
                                        expected: 0u8,
                                        actual: entry_tag.wire_type() as u8,
                                    });
                                }
                                val = ::buffa::types::decode_uint64(&mut entry_cur)?;
                            }
                            _ => {
                                ::buffa::encoding::skip_field_depth(
                                    entry_tag,
                                    &mut entry_cur,
                                    depth,
                                )?;
                            }
                        }
                    }
                    view.read_stats.push(key, val);
                }
                _ => {
                    ::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 DetailView<'a> {
    type Owned = Detail;
    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) -> Detail {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        Detail {
            sequence_number: self.sequence_number,
            read_stats: self
                .read_stats
                .iter()
                .map(|(k, v)| (k.to_string(), *v))
                .collect(),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for DetailView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<DetailView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for DetailView<'a> {
    type Static = DetailView<'static>;
}
/// Reference to a typed field inside a stored key or value. Used by KvExpr
/// and KvPredicateCheck to locate the data to evaluate.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct KvFieldRef {
    #[serde(flatten)]
    pub field: Option<kv_field_ref::Field>,
    #[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 KvFieldRef {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("KvFieldRef").field("field", &self.field).finish()
    }
}
impl KvFieldRef {
    /// 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.query.v1.KvFieldRef";
}
unsafe impl ::buffa::DefaultInstance for KvFieldRef {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvFieldRef> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for KvFieldRef {
    /// 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.field {
            match v {
                kv_field_ref::Field::Key(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_field_ref::Field::ZOrderKey(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_field_ref::Field::Value(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.field {
            match v {
                kv_field_ref::Field::Key(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);
                }
                kv_field_ref::Field::ZOrderKey(x) => {
                    ::buffa::encoding::Tag::new(
                            2u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_field_ref::Field::Value(x) => {
                    ::buffa::encoding::Tag::new(
                            3u32,
                            ::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(
                    kv_field_ref::Field::Key(ref mut existing),
                ) = self.field
                {
                    ::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.field = ::core::option::Option::Some(
                        kv_field_ref::Field::Key(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            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 let ::core::option::Option::Some(
                    kv_field_ref::Field::ZOrderKey(ref mut existing),
                ) = self.field
                {
                    ::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.field = ::core::option::Option::Some(
                        kv_field_ref::Field::ZOrderKey(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            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 let ::core::option::Option::Some(
                    kv_field_ref::Field::Value(ref mut existing),
                ) = self.field
                {
                    ::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.field = ::core::option::Option::Some(
                        kv_field_ref::Field::Value(::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.field = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for KvFieldRef {
    const PROTO_FQN: &'static str = "store.query.v1.KvFieldRef";
    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 KvFieldRef {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct _V;
        impl<'de> serde::de::Visitor<'de> for _V {
            type Value = KvFieldRef;
            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
                f.write_str("struct KvFieldRef")
            }
            #[allow(clippy::field_reassign_with_default)]
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                mut map: A,
            ) -> Result<KvFieldRef, A::Error> {
                let mut __oneof_field: Option<kv_field_ref::Field> = None;
                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
                    match key.as_str() {
                        "key" => {
                            let v: Option<kv_field_ref::KeyField> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_field_ref::KeyField,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_field.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'field'",
                                        ),
                                    );
                                }
                                __oneof_field = Some(
                                    kv_field_ref::Field::Key(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "zOrderKey" | "z_order_key" => {
                            let v: Option<kv_field_ref::ZOrderKeyField> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_field_ref::ZOrderKeyField,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_field.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'field'",
                                        ),
                                    );
                                }
                                __oneof_field = Some(
                                    kv_field_ref::Field::ZOrderKey(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "value" => {
                            let v: Option<kv_field_ref::ValueField> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_field_ref::ValueField,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_field.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'field'",
                                        ),
                                    );
                                }
                                __oneof_field = Some(
                                    kv_field_ref::Field::Value(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        _ => {
                            map.next_value::<serde::de::IgnoredAny>()?;
                        }
                    }
                }
                let mut __r = <KvFieldRef as ::core::default::Default>::default();
                __r.field = __oneof_field;
                Ok(__r)
            }
        }
        d.deserialize_map(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for KvFieldRef {
    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 __KV_FIELD_REF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.KvFieldRef",
    to_json: ::buffa::type_registry::any_to_json::<KvFieldRef>,
    from_json: ::buffa::type_registry::any_from_json::<KvFieldRef>,
    is_wkt: false,
};
/// Reference to a typed field inside a stored key or value. Used by KvExpr
/// and KvPredicateCheck to locate the data to evaluate.
#[derive(Clone, Debug, Default)]
pub struct KvFieldRefView<'a> {
    pub field: ::core::option::Option<kv_field_ref::FieldView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> KvFieldRefView<'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(kv_field_ref::FieldView::Key(ref mut existing)) = view
                        .field
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.field = Some(
                            kv_field_ref::FieldView::Key(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_field_ref::KeyFieldView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                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)?;
                    if let Some(kv_field_ref::FieldView::ZOrderKey(ref mut existing)) = view
                        .field
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.field = Some(
                            kv_field_ref::FieldView::ZOrderKey(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_field_ref::ZOrderKeyFieldView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                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)?;
                    if let Some(kv_field_ref::FieldView::Value(ref mut existing)) = view
                        .field
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.field = Some(
                            kv_field_ref::FieldView::Value(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_field_ref::ValueFieldView::_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 KvFieldRefView<'a> {
    type Owned = KvFieldRef;
    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) -> KvFieldRef {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        KvFieldRef {
            field: self
                .field
                .as_ref()
                .map(|v| match v {
                    kv_field_ref::FieldView::Key(v) => {
                        kv_field_ref::Field::Key(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_field_ref::FieldView::ZOrderKey(v) => {
                        kv_field_ref::Field::ZOrderKey(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_field_ref::FieldView::Value(v) => {
                        kv_field_ref::Field::Value(
                            ::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 KvFieldRefView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvFieldRefView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for KvFieldRefView<'a> {
    type Static = KvFieldRefView<'static>;
}
pub mod kv_field_ref {
    #[allow(unused_imports)]
    use super::*;
    /// A field extracted from the key bytes at a fixed bit offset.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct KeyField {
        /// Bit offset into the key payload where this field starts.
        ///
        /// Field 1: `bit_offset`
        #[serde(
            rename = "bitOffset",
            alias = "bit_offset",
            with = "::buffa::json_helpers::uint32",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
        )]
        pub bit_offset: u32,
        /// Scalar type used to decode the field bytes.
        ///
        /// Field 2: `kind`
        #[serde(
            rename = "kind",
            with = "::buffa::json_helpers::proto_enum",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
        )]
        pub kind: ::buffa::EnumValue<KvFieldKind>,
        /// Length in bytes when `kind` is `FIXED_SIZE_BINARY`; ignored otherwise.
        ///
        /// Field 3: `fixed_size_binary_len`
        #[serde(
            rename = "fixedSizeBinaryLen",
            alias = "fixed_size_binary_len",
            with = "::buffa::json_helpers::uint32",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
        )]
        pub fixed_size_binary_len: 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 KeyField {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("KeyField")
                .field("bit_offset", &self.bit_offset)
                .field("kind", &self.kind)
                .field("fixed_size_binary_len", &self.fixed_size_binary_len)
                .finish()
        }
    }
    impl KeyField {
        /// 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.query.v1.KvFieldRef.KeyField";
    }
    unsafe impl ::buffa::DefaultInstance for KeyField {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<KeyField> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for KeyField {
        /// 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.bit_offset != 0u32 {
                size
                    += 1u32 + ::buffa::types::uint32_encoded_len(self.bit_offset) as u32;
            }
            {
                let val = self.kind.to_i32();
                if val != 0 {
                    size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
                }
            }
            if self.fixed_size_binary_len != 0u32 {
                size
                    += 1u32
                        + ::buffa::types::uint32_encoded_len(self.fixed_size_binary_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.bit_offset != 0u32 {
                ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint32(self.bit_offset, buf);
            }
            {
                let val = self.kind.to_i32();
                if val != 0 {
                    ::buffa::encoding::Tag::new(
                            2u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int32(val, buf);
                }
            }
            if self.fixed_size_binary_len != 0u32 {
                ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint32(self.fixed_size_binary_len, 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.bit_offset = ::buffa::types::decode_uint32(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.kind = ::buffa::EnumValue::from(
                        ::buffa::types::decode_int32(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.fixed_size_binary_len = ::buffa::types::decode_uint32(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.bit_offset = 0u32;
            self.kind = ::buffa::EnumValue::from(0);
            self.fixed_size_binary_len = 0u32;
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for KeyField {
        const PROTO_FQN: &'static str = "store.query.v1.KvFieldRef.KeyField";
        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 KeyField {
        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 __KEY_FIELD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvFieldRef.KeyField",
        to_json: ::buffa::type_registry::any_to_json::<KeyField>,
        from_json: ::buffa::type_registry::any_from_json::<KeyField>,
        is_wkt: false,
    };
    /// A field extracted from the key bytes at a fixed bit offset.
    #[derive(Clone, Debug, Default)]
    pub struct KeyFieldView<'a> {
        /// Bit offset into the key payload where this field starts.
        ///
        /// Field 1: `bit_offset`
        pub bit_offset: u32,
        /// Scalar type used to decode the field bytes.
        ///
        /// Field 2: `kind`
        pub kind: ::buffa::EnumValue<KvFieldKind>,
        /// Length in bytes when `kind` is `FIXED_SIZE_BINARY`; ignored otherwise.
        ///
        /// Field 3: `fixed_size_binary_len`
        pub fixed_size_binary_len: u32,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> KeyFieldView<'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.bit_offset = ::buffa::types::decode_uint32(&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.kind = ::buffa::EnumValue::from(
                            ::buffa::types::decode_int32(&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.fixed_size_binary_len = ::buffa::types::decode_uint32(
                            &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 KeyFieldView<'a> {
        type Owned = KeyField;
        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) -> KeyField {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            KeyField {
                bit_offset: self.bit_offset,
                kind: self.kind,
                fixed_size_binary_len: self.fixed_size_binary_len,
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for KeyFieldView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<KeyFieldView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for KeyFieldView<'a> {
        type Static = KeyFieldView<'static>;
    }
    /// A field extracted from a Z-order (Morton) interleaved key. The field
    /// is de-interleaved from the composite key using the position and widths.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct ZOrderKeyField {
        /// Bit offset into the key payload where the Z-order block starts.
        ///
        /// Field 1: `bit_offset`
        #[serde(
            rename = "bitOffset",
            alias = "bit_offset",
            with = "::buffa::json_helpers::uint32",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
        )]
        pub bit_offset: u32,
        /// Zero-based position of this dimension within the Z-order interleaving.
        ///
        /// Field 2: `field_position`
        #[serde(
            rename = "fieldPosition",
            alias = "field_position",
            with = "::buffa::json_helpers::uint32",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
        )]
        pub field_position: u32,
        /// Bit widths of each dimension in the Z-order curve, in order.
        ///
        /// Field 3: `field_widths`
        #[serde(
            rename = "fieldWidths",
            alias = "field_widths",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
            deserialize_with = "::buffa::json_helpers::null_as_default"
        )]
        pub field_widths: ::buffa::alloc::vec::Vec<u32>,
        /// Scalar type used to decode the de-interleaved value.
        ///
        /// Field 4: `kind`
        #[serde(
            rename = "kind",
            with = "::buffa::json_helpers::proto_enum",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
        )]
        pub kind: ::buffa::EnumValue<KvFieldKind>,
        /// Length in bytes when `kind` is `FIXED_SIZE_BINARY`; ignored otherwise.
        ///
        /// Field 5: `fixed_size_binary_len`
        #[serde(
            rename = "fixedSizeBinaryLen",
            alias = "fixed_size_binary_len",
            with = "::buffa::json_helpers::uint32",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
        )]
        pub fixed_size_binary_len: 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 ZOrderKeyField {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("ZOrderKeyField")
                .field("bit_offset", &self.bit_offset)
                .field("field_position", &self.field_position)
                .field("field_widths", &self.field_widths)
                .field("kind", &self.kind)
                .field("fixed_size_binary_len", &self.fixed_size_binary_len)
                .finish()
        }
    }
    impl ZOrderKeyField {
        /// 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.query.v1.KvFieldRef.ZOrderKeyField";
    }
    unsafe impl ::buffa::DefaultInstance for ZOrderKeyField {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<ZOrderKeyField> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for ZOrderKeyField {
        /// 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.bit_offset != 0u32 {
                size
                    += 1u32 + ::buffa::types::uint32_encoded_len(self.bit_offset) as u32;
            }
            if self.field_position != 0u32 {
                size
                    += 1u32
                        + ::buffa::types::uint32_encoded_len(self.field_position) as u32;
            }
            {
                let val = self.kind.to_i32();
                if val != 0 {
                    size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
                }
            }
            if self.fixed_size_binary_len != 0u32 {
                size
                    += 1u32
                        + ::buffa::types::uint32_encoded_len(self.fixed_size_binary_len)
                            as u32;
            }
            if !self.field_widths.is_empty() {
                let payload: u32 = self
                    .field_widths
                    .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.bit_offset != 0u32 {
                ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint32(self.bit_offset, buf);
            }
            if self.field_position != 0u32 {
                ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint32(self.field_position, buf);
            }
            {
                let val = self.kind.to_i32();
                if val != 0 {
                    ::buffa::encoding::Tag::new(
                            4u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int32(val, buf);
                }
            }
            if self.fixed_size_binary_len != 0u32 {
                ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint32(self.fixed_size_binary_len, buf);
            }
            if !self.field_widths.is_empty() {
                let payload: u32 = self
                    .field_widths
                    .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.field_widths {
                    ::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::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    self.bit_offset = ::buffa::types::decode_uint32(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.field_position = ::buffa::types::decode_uint32(buf)?;
                }
                4u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    self.kind = ::buffa::EnumValue::from(
                        ::buffa::types::decode_int32(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.fixed_size_binary_len = ::buffa::types::decode_uint32(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.field_widths.reserve(len);
                        let mut limited = buf.take(len);
                        while limited.has_remaining() {
                            self.field_widths
                                .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.field_widths.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,
                        });
                    }
                }
                _ => {
                    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.bit_offset = 0u32;
            self.field_position = 0u32;
            self.kind = ::buffa::EnumValue::from(0);
            self.fixed_size_binary_len = 0u32;
            self.field_widths.clear();
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for ZOrderKeyField {
        const PROTO_FQN: &'static str = "store.query.v1.KvFieldRef.ZOrderKeyField";
        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 ZOrderKeyField {
        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 __Z_ORDER_KEY_FIELD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvFieldRef.ZOrderKeyField",
        to_json: ::buffa::type_registry::any_to_json::<ZOrderKeyField>,
        from_json: ::buffa::type_registry::any_from_json::<ZOrderKeyField>,
        is_wkt: false,
    };
    /// A field extracted from a Z-order (Morton) interleaved key. The field
    /// is de-interleaved from the composite key using the position and widths.
    #[derive(Clone, Debug, Default)]
    pub struct ZOrderKeyFieldView<'a> {
        /// Bit offset into the key payload where the Z-order block starts.
        ///
        /// Field 1: `bit_offset`
        pub bit_offset: u32,
        /// Zero-based position of this dimension within the Z-order interleaving.
        ///
        /// Field 2: `field_position`
        pub field_position: u32,
        /// Bit widths of each dimension in the Z-order curve, in order.
        ///
        /// Field 3: `field_widths`
        pub field_widths: ::buffa::RepeatedView<'a, u32>,
        /// Scalar type used to decode the de-interleaved value.
        ///
        /// Field 4: `kind`
        pub kind: ::buffa::EnumValue<KvFieldKind>,
        /// Length in bytes when `kind` is `FIXED_SIZE_BINARY`; ignored otherwise.
        ///
        /// Field 5: `fixed_size_binary_len`
        pub fixed_size_binary_len: u32,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> ZOrderKeyFieldView<'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.bit_offset = ::buffa::types::decode_uint32(&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.field_position = ::buffa::types::decode_uint32(&mut cur)?;
                    }
                    4u32 => {
                        if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                            return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                                field_number: 4u32,
                                expected: 0u8,
                                actual: tag.wire_type() as u8,
                            });
                        }
                        view.kind = ::buffa::EnumValue::from(
                            ::buffa::types::decode_int32(&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.fixed_size_binary_len = ::buffa::types::decode_uint32(
                            &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.field_widths
                                    .push(::buffa::types::decode_uint32(&mut pcur)?);
                            }
                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
                        {
                            view.field_widths
                                .push(::buffa::types::decode_uint32(&mut cur)?);
                        } else {
                            return Err(::buffa::DecodeError::WireTypeMismatch {
                                field_number: 3u32,
                                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 ZOrderKeyFieldView<'a> {
        type Owned = ZOrderKeyField;
        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) -> ZOrderKeyField {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            ZOrderKeyField {
                bit_offset: self.bit_offset,
                field_position: self.field_position,
                field_widths: self.field_widths.to_vec(),
                kind: self.kind,
                fixed_size_binary_len: self.fixed_size_binary_len,
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for ZOrderKeyFieldView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<ZOrderKeyFieldView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for ZOrderKeyFieldView<'a> {
        type Static = ZOrderKeyFieldView<'static>;
    }
    /// A field extracted from the stored value (the encoded `StoredRow`).
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct ValueField {
        /// Zero-based column index within the `StoredRow`.
        ///
        /// Field 1: `index`
        #[serde(
            rename = "index",
            with = "::buffa::json_helpers::uint32",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
        )]
        pub index: u32,
        /// Scalar type of this column.
        ///
        /// Field 2: `kind`
        #[serde(
            rename = "kind",
            with = "::buffa::json_helpers::proto_enum",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
        )]
        pub kind: ::buffa::EnumValue<KvFieldKind>,
        /// Whether the column is nullable. When true, a missing value yields NULL
        /// rather than an error.
        ///
        /// 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,
        /// Length in bytes when `kind` is `FIXED_SIZE_BINARY`; ignored otherwise.
        ///
        /// Field 4: `fixed_size_binary_len`
        #[serde(
            rename = "fixedSizeBinaryLen",
            alias = "fixed_size_binary_len",
            with = "::buffa::json_helpers::uint32",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
        )]
        pub fixed_size_binary_len: 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 ValueField {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("ValueField")
                .field("index", &self.index)
                .field("kind", &self.kind)
                .field("nullable", &self.nullable)
                .field("fixed_size_binary_len", &self.fixed_size_binary_len)
                .finish()
        }
    }
    impl ValueField {
        /// 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.query.v1.KvFieldRef.ValueField";
    }
    unsafe impl ::buffa::DefaultInstance for ValueField {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<ValueField> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for ValueField {
        /// 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.index != 0u32 {
                size += 1u32 + ::buffa::types::uint32_encoded_len(self.index) as u32;
            }
            {
                let val = self.kind.to_i32();
                if val != 0 {
                    size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
                }
            }
            if self.nullable {
                size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
            }
            if self.fixed_size_binary_len != 0u32 {
                size
                    += 1u32
                        + ::buffa::types::uint32_encoded_len(self.fixed_size_binary_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.index != 0u32 {
                ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint32(self.index, buf);
            }
            {
                let val = self.kind.to_i32();
                if val != 0 {
                    ::buffa::encoding::Tag::new(
                            2u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int32(val, buf);
                }
            }
            if self.nullable {
                ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_bool(self.nullable, buf);
            }
            if self.fixed_size_binary_len != 0u32 {
                ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint32(self.fixed_size_binary_len, 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.index = ::buffa::types::decode_uint32(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.kind = ::buffa::EnumValue::from(
                        ::buffa::types::decode_int32(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)?;
                }
                4u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    self.fixed_size_binary_len = ::buffa::types::decode_uint32(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.index = 0u32;
            self.kind = ::buffa::EnumValue::from(0);
            self.nullable = false;
            self.fixed_size_binary_len = 0u32;
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for ValueField {
        const PROTO_FQN: &'static str = "store.query.v1.KvFieldRef.ValueField";
        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 ValueField {
        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 __VALUE_FIELD_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvFieldRef.ValueField",
        to_json: ::buffa::type_registry::any_to_json::<ValueField>,
        from_json: ::buffa::type_registry::any_from_json::<ValueField>,
        is_wkt: false,
    };
    /// A field extracted from the stored value (the encoded `StoredRow`).
    #[derive(Clone, Debug, Default)]
    pub struct ValueFieldView<'a> {
        /// Zero-based column index within the `StoredRow`.
        ///
        /// Field 1: `index`
        pub index: u32,
        /// Scalar type of this column.
        ///
        /// Field 2: `kind`
        pub kind: ::buffa::EnumValue<KvFieldKind>,
        /// Whether the column is nullable. When true, a missing value yields NULL
        /// rather than an error.
        ///
        /// Field 3: `nullable`
        pub nullable: bool,
        /// Length in bytes when `kind` is `FIXED_SIZE_BINARY`; ignored otherwise.
        ///
        /// Field 4: `fixed_size_binary_len`
        pub fixed_size_binary_len: u32,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> ValueFieldView<'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.index = ::buffa::types::decode_uint32(&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.kind = ::buffa::EnumValue::from(
                            ::buffa::types::decode_int32(&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)?;
                    }
                    4u32 => {
                        if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                            return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                                field_number: 4u32,
                                expected: 0u8,
                                actual: tag.wire_type() as u8,
                            });
                        }
                        view.fixed_size_binary_len = ::buffa::types::decode_uint32(
                            &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 ValueFieldView<'a> {
        type Owned = ValueField;
        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) -> ValueField {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            ValueField {
                index: self.index,
                kind: self.kind,
                nullable: self.nullable,
                fixed_size_binary_len: self.fixed_size_binary_len,
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for ValueFieldView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<ValueFieldView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for ValueFieldView<'a> {
        type Static = ValueFieldView<'static>;
    }
    #[derive(Clone, PartialEq, Debug)]
    pub enum Field {
        Key(::buffa::alloc::boxed::Box<super::kv_field_ref::KeyField>),
        ZOrderKey(::buffa::alloc::boxed::Box<super::kv_field_ref::ZOrderKeyField>),
        Value(::buffa::alloc::boxed::Box<super::kv_field_ref::ValueField>),
    }
    impl ::buffa::Oneof for Field {}
    impl From<super::kv_field_ref::KeyField> for Field {
        fn from(v: super::kv_field_ref::KeyField) -> Self {
            Self::Key(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_field_ref::KeyField> for ::core::option::Option<Field> {
        fn from(v: super::kv_field_ref::KeyField) -> Self {
            Self::Some(Field::from(v))
        }
    }
    impl From<super::kv_field_ref::ZOrderKeyField> for Field {
        fn from(v: super::kv_field_ref::ZOrderKeyField) -> Self {
            Self::ZOrderKey(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_field_ref::ZOrderKeyField> for ::core::option::Option<Field> {
        fn from(v: super::kv_field_ref::ZOrderKeyField) -> Self {
            Self::Some(Field::from(v))
        }
    }
    impl From<super::kv_field_ref::ValueField> for Field {
        fn from(v: super::kv_field_ref::ValueField) -> Self {
            Self::Value(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_field_ref::ValueField> for ::core::option::Option<Field> {
        fn from(v: super::kv_field_ref::ValueField) -> Self {
            Self::Some(Field::from(v))
        }
    }
    impl serde::Serialize for Field {
        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 {
                Field::Key(v) => {
                    map.serialize_entry("key", v)?;
                }
                Field::ZOrderKey(v) => {
                    map.serialize_entry("zOrderKey", v)?;
                }
                Field::Value(v) => {
                    map.serialize_entry("value", v)?;
                }
            }
            map.end()
        }
    }
    #[derive(Clone, Debug)]
    pub enum FieldView<'a> {
        Key(::buffa::alloc::boxed::Box<super::kv_field_ref::KeyFieldView<'a>>),
        ZOrderKey(
            ::buffa::alloc::boxed::Box<super::kv_field_ref::ZOrderKeyFieldView<'a>>,
        ),
        Value(::buffa::alloc::boxed::Box<super::kv_field_ref::ValueFieldView<'a>>),
    }
}
/// A single scalar value produced by reduction or used as a literal in
/// expressions. The variant must match the `KvFieldKind` of the expression
/// it participates in.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct KvReducedValue {
    #[serde(flatten)]
    pub value: Option<kv_reduced_value::Value>,
    #[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 KvReducedValue {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("KvReducedValue").field("value", &self.value).finish()
    }
}
impl KvReducedValue {
    /// 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.query.v1.KvReducedValue";
}
unsafe impl ::buffa::DefaultInstance for KvReducedValue {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvReducedValue> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for KvReducedValue {
    /// 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.value {
            match v {
                kv_reduced_value::Value::Int64Value(v) => {
                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
                }
                kv_reduced_value::Value::Uint64Value(v) => {
                    size += 1u32 + ::buffa::types::uint64_encoded_len(*v) as u32;
                }
                kv_reduced_value::Value::Float64Value(_x) => {
                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
                }
                kv_reduced_value::Value::BooleanValue(_x) => {
                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
                }
                kv_reduced_value::Value::Utf8Value(x) => {
                    size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
                }
                kv_reduced_value::Value::Date32Value(v) => {
                    size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
                }
                kv_reduced_value::Value::Date64Value(v) => {
                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
                }
                kv_reduced_value::Value::TimestampValue(v) => {
                    size += 1u32 + ::buffa::types::int64_encoded_len(*v) as u32;
                }
                kv_reduced_value::Value::Decimal128Value(x) => {
                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
                }
                kv_reduced_value::Value::FixedSizeBinaryValue(x) => {
                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
                }
                kv_reduced_value::Value::Decimal256Value(x) => {
                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) 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 let ::core::option::Option::Some(ref v) = self.value {
            match v {
                kv_reduced_value::Value::Int64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            1u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int64(*x, buf);
                }
                kv_reduced_value::Value::Uint64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            2u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_uint64(*x, buf);
                }
                kv_reduced_value::Value::Float64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            3u32,
                            ::buffa::encoding::WireType::Fixed64,
                        )
                        .encode(buf);
                    ::buffa::types::encode_double(*x, buf);
                }
                kv_reduced_value::Value::BooleanValue(x) => {
                    ::buffa::encoding::Tag::new(
                            4u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bool(*x, buf);
                }
                kv_reduced_value::Value::Utf8Value(x) => {
                    ::buffa::encoding::Tag::new(
                            5u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_string(x, buf);
                }
                kv_reduced_value::Value::Date32Value(x) => {
                    ::buffa::encoding::Tag::new(
                            6u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int32(*x, buf);
                }
                kv_reduced_value::Value::Date64Value(x) => {
                    ::buffa::encoding::Tag::new(
                            7u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int64(*x, buf);
                }
                kv_reduced_value::Value::TimestampValue(x) => {
                    ::buffa::encoding::Tag::new(
                            8u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_int64(*x, buf);
                }
                kv_reduced_value::Value::Decimal128Value(x) => {
                    ::buffa::encoding::Tag::new(
                            9u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bytes(x, buf);
                }
                kv_reduced_value::Value::FixedSizeBinaryValue(x) => {
                    ::buffa::encoding::Tag::new(
                            10u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bytes(x, buf);
                }
                kv_reduced_value::Value::Decimal256Value(x) => {
                    ::buffa::encoding::Tag::new(
                            11u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bytes(x, 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.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Int64Value(
                        ::buffa::types::decode_int64(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.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Uint64Value(
                        ::buffa::types::decode_uint64(buf)?,
                    ),
                );
            }
            3u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 3u32,
                        expected: 1u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Float64Value(
                        ::buffa::types::decode_double(buf)?,
                    ),
                );
            }
            4u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 4u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::BooleanValue(
                        ::buffa::types::decode_bool(buf)?,
                    ),
                );
            }
            5u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 5u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Utf8Value(
                        ::buffa::types::decode_string(buf)?,
                    ),
                );
            }
            6u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 6u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Date32Value(
                        ::buffa::types::decode_int32(buf)?,
                    ),
                );
            }
            7u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 7u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Date64Value(
                        ::buffa::types::decode_int64(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.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::TimestampValue(
                        ::buffa::types::decode_int64(buf)?,
                    ),
                );
            }
            9u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 9u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Decimal128Value(
                        ::buffa::types::decode_bytes(buf)?,
                    ),
                );
            }
            10u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 10u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::FixedSizeBinaryValue(
                        ::buffa::types::decode_bytes(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.value = ::core::option::Option::Some(
                    kv_reduced_value::Value::Decimal256Value(
                        ::buffa::types::decode_bytes(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.value = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for KvReducedValue {
    const PROTO_FQN: &'static str = "store.query.v1.KvReducedValue";
    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 KvReducedValue {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct _V;
        impl<'de> serde::de::Visitor<'de> for _V {
            type Value = KvReducedValue;
            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
                f.write_str("struct KvReducedValue")
            }
            #[allow(clippy::field_reassign_with_default)]
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                mut map: A,
            ) -> Result<KvReducedValue, A::Error> {
                let mut __oneof_value: Option<kv_reduced_value::Value> = None;
                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
                    match key.as_str() {
                        "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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(kv_reduced_value::Value::Utf8Value(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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::Decimal128Value(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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::FixedSizeBinaryValue(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_value.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'value'",
                                        ),
                                    );
                                }
                                __oneof_value = Some(
                                    kv_reduced_value::Value::Decimal256Value(v),
                                );
                            }
                        }
                        _ => {
                            map.next_value::<serde::de::IgnoredAny>()?;
                        }
                    }
                }
                let mut __r = <KvReducedValue as ::core::default::Default>::default();
                __r.value = __oneof_value;
                Ok(__r)
            }
        }
        d.deserialize_map(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for KvReducedValue {
    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 __KV_REDUCED_VALUE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.KvReducedValue",
    to_json: ::buffa::type_registry::any_to_json::<KvReducedValue>,
    from_json: ::buffa::type_registry::any_from_json::<KvReducedValue>,
    is_wkt: false,
};
/// A single scalar value produced by reduction or used as a literal in
/// expressions. The variant must match the `KvFieldKind` of the expression
/// it participates in.
#[derive(Clone, Debug, Default)]
pub struct KvReducedValueView<'a> {
    pub value: ::core::option::Option<kv_reduced_value::ValueView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> KvReducedValueView<'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.value = Some(
                        kv_reduced_value::ValueView::Int64Value(
                            ::buffa::types::decode_int64(&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.value = Some(
                        kv_reduced_value::ValueView::Uint64Value(
                            ::buffa::types::decode_uint64(&mut cur)?,
                        ),
                    );
                }
                3u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 3u32,
                            expected: 1u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.value = Some(
                        kv_reduced_value::ValueView::Float64Value(
                            ::buffa::types::decode_double(&mut cur)?,
                        ),
                    );
                }
                4u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.value = Some(
                        kv_reduced_value::ValueView::BooleanValue(
                            ::buffa::types::decode_bool(&mut cur)?,
                        ),
                    );
                }
                5u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 5u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.value = Some(
                        kv_reduced_value::ValueView::Utf8Value(
                            ::buffa::types::borrow_str(&mut cur)?,
                        ),
                    );
                }
                6u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 6u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.value = Some(
                        kv_reduced_value::ValueView::Date32Value(
                            ::buffa::types::decode_int32(&mut cur)?,
                        ),
                    );
                }
                7u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 7u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.value = Some(
                        kv_reduced_value::ValueView::Date64Value(
                            ::buffa::types::decode_int64(&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.value = Some(
                        kv_reduced_value::ValueView::TimestampValue(
                            ::buffa::types::decode_int64(&mut cur)?,
                        ),
                    );
                }
                9u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 9u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.value = Some(
                        kv_reduced_value::ValueView::Decimal128Value(
                            ::buffa::types::borrow_bytes(&mut cur)?,
                        ),
                    );
                }
                10u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 10u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.value = Some(
                        kv_reduced_value::ValueView::FixedSizeBinaryValue(
                            ::buffa::types::borrow_bytes(&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.value = Some(
                        kv_reduced_value::ValueView::Decimal256Value(
                            ::buffa::types::borrow_bytes(&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 KvReducedValueView<'a> {
    type Owned = KvReducedValue;
    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) -> KvReducedValue {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        KvReducedValue {
            value: self
                .value
                .as_ref()
                .map(|v| match v {
                    kv_reduced_value::ValueView::Int64Value(v) => {
                        kv_reduced_value::Value::Int64Value(*v)
                    }
                    kv_reduced_value::ValueView::Uint64Value(v) => {
                        kv_reduced_value::Value::Uint64Value(*v)
                    }
                    kv_reduced_value::ValueView::Float64Value(v) => {
                        kv_reduced_value::Value::Float64Value(*v)
                    }
                    kv_reduced_value::ValueView::BooleanValue(v) => {
                        kv_reduced_value::Value::BooleanValue(*v)
                    }
                    kv_reduced_value::ValueView::Utf8Value(v) => {
                        kv_reduced_value::Value::Utf8Value(v.to_string())
                    }
                    kv_reduced_value::ValueView::Date32Value(v) => {
                        kv_reduced_value::Value::Date32Value(*v)
                    }
                    kv_reduced_value::ValueView::Date64Value(v) => {
                        kv_reduced_value::Value::Date64Value(*v)
                    }
                    kv_reduced_value::ValueView::TimestampValue(v) => {
                        kv_reduced_value::Value::TimestampValue(*v)
                    }
                    kv_reduced_value::ValueView::Decimal128Value(v) => {
                        kv_reduced_value::Value::Decimal128Value((v).to_vec())
                    }
                    kv_reduced_value::ValueView::FixedSizeBinaryValue(v) => {
                        kv_reduced_value::Value::FixedSizeBinaryValue((v).to_vec())
                    }
                    kv_reduced_value::ValueView::Decimal256Value(v) => {
                        kv_reduced_value::Value::Decimal256Value((v).to_vec())
                    }
                }),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for KvReducedValueView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvReducedValueView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for KvReducedValueView<'a> {
    type Static = KvReducedValueView<'static>;
}
pub mod kv_reduced_value {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, PartialEq, Debug)]
    pub enum Value {
        Int64Value(i64),
        Uint64Value(u64),
        Float64Value(f64),
        BooleanValue(bool),
        Utf8Value(::buffa::alloc::string::String),
        Date32Value(i32),
        Date64Value(i64),
        TimestampValue(i64),
        Decimal128Value(::buffa::alloc::vec::Vec<u8>),
        FixedSizeBinaryValue(::buffa::alloc::vec::Vec<u8>),
        Decimal256Value(::buffa::alloc::vec::Vec<u8>),
    }
    impl ::buffa::Oneof for Value {}
    impl serde::Serialize for Value {
        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 {
                Value::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))?;
                }
                Value::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))?;
                }
                Value::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))?;
                }
                Value::BooleanValue(v) => {
                    map.serialize_entry("booleanValue", v)?;
                }
                Value::Utf8Value(v) => {
                    map.serialize_entry("utf8Value", v)?;
                }
                Value::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))?;
                }
                Value::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))?;
                }
                Value::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))?;
                }
                Value::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))?;
                }
                Value::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))?;
                }
                Value::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))?;
                }
            }
            map.end()
        }
    }
    #[derive(Clone, Debug)]
    pub enum ValueView<'a> {
        Int64Value(i64),
        Uint64Value(u64),
        Float64Value(f64),
        BooleanValue(bool),
        Utf8Value(&'a str),
        Date32Value(i32),
        Date64Value(i64),
        TimestampValue(i64),
        Decimal128Value(&'a [u8]),
        FixedSizeBinaryValue(&'a [u8]),
        Decimal256Value(&'a [u8]),
    }
}
/// An expression tree evaluated per row during reduction. Leaf nodes are field
/// references or literal values; interior nodes are arithmetic or transform
/// operations.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct KvExpr {
    #[serde(flatten)]
    pub expr: Option<kv_expr::Expr>,
    #[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 KvExpr {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("KvExpr").field("expr", &self.expr).finish()
    }
}
impl KvExpr {
    /// 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.query.v1.KvExpr";
}
unsafe impl ::buffa::DefaultInstance for KvExpr {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvExpr> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for KvExpr {
    /// 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.expr {
            match v {
                kv_expr::Expr::Field(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_expr::Expr::Literal(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_expr::Expr::Add(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_expr::Expr::Sub(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_expr::Expr::Mul(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_expr::Expr::Div(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_expr::Expr::Lower(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_expr::Expr::DateTruncDay(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.expr {
            match v {
                kv_expr::Expr::Field(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);
                }
                kv_expr::Expr::Literal(x) => {
                    ::buffa::encoding::Tag::new(
                            2u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_expr::Expr::Add(x) => {
                    ::buffa::encoding::Tag::new(
                            3u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_expr::Expr::Sub(x) => {
                    ::buffa::encoding::Tag::new(
                            4u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_expr::Expr::Mul(x) => {
                    ::buffa::encoding::Tag::new(
                            5u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_expr::Expr::Div(x) => {
                    ::buffa::encoding::Tag::new(
                            6u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_expr::Expr::Lower(x) => {
                    ::buffa::encoding::Tag::new(
                            7u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_expr::Expr::DateTruncDay(x) => {
                    ::buffa::encoding::Tag::new(
                            8u32,
                            ::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(
                    kv_expr::Expr::Field(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::Field(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            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 let ::core::option::Option::Some(
                    kv_expr::Expr::Literal(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::Literal(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            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 let ::core::option::Option::Some(
                    kv_expr::Expr::Add(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::Add(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            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 let ::core::option::Option::Some(
                    kv_expr::Expr::Sub(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::Sub(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            5u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 5u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_expr::Expr::Mul(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::Mul(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            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,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_expr::Expr::Div(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::Div(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            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,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_expr::Expr::Lower(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::Lower(::buffa::alloc::boxed::Box::new(val)),
                    );
                }
            }
            8u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 8u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_expr::Expr::DateTruncDay(ref mut existing),
                ) = self.expr
                {
                    ::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.expr = ::core::option::Option::Some(
                        kv_expr::Expr::DateTruncDay(::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.expr = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for KvExpr {
    const PROTO_FQN: &'static str = "store.query.v1.KvExpr";
    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 KvExpr {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct _V;
        impl<'de> serde::de::Visitor<'de> for _V {
            type Value = KvExpr;
            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
                f.write_str("struct KvExpr")
            }
            #[allow(clippy::field_reassign_with_default)]
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                mut map: A,
            ) -> Result<KvExpr, A::Error> {
                let mut __oneof_expr: Option<kv_expr::Expr> = None;
                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
                    match key.as_str() {
                        "field" => {
                            let v: Option<KvFieldRef> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            KvFieldRef,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::Field(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "literal" => {
                            let v: Option<KvReducedValue> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            KvReducedValue,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::Literal(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "add" => {
                            let v: Option<kv_expr::BinaryExpr> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_expr::BinaryExpr,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::Add(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "sub" => {
                            let v: Option<kv_expr::BinaryExpr> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_expr::BinaryExpr,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::Sub(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "mul" => {
                            let v: Option<kv_expr::BinaryExpr> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_expr::BinaryExpr,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::Mul(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "div" => {
                            let v: Option<kv_expr::BinaryExpr> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_expr::BinaryExpr,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::Div(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "lower" => {
                            let v: Option<KvExpr> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            KvExpr,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::Lower(::buffa::alloc::boxed::Box::new(v)),
                                );
                            }
                        }
                        "dateTruncDay" | "date_trunc_day" => {
                            let v: Option<KvExpr> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            KvExpr,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_expr.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'expr'",
                                        ),
                                    );
                                }
                                __oneof_expr = Some(
                                    kv_expr::Expr::DateTruncDay(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        _ => {
                            map.next_value::<serde::de::IgnoredAny>()?;
                        }
                    }
                }
                let mut __r = <KvExpr as ::core::default::Default>::default();
                __r.expr = __oneof_expr;
                Ok(__r)
            }
        }
        d.deserialize_map(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for KvExpr {
    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 __KV_EXPR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.KvExpr",
    to_json: ::buffa::type_registry::any_to_json::<KvExpr>,
    from_json: ::buffa::type_registry::any_from_json::<KvExpr>,
    is_wkt: false,
};
/// An expression tree evaluated per row during reduction. Leaf nodes are field
/// references or literal values; interior nodes are arithmetic or transform
/// operations.
#[derive(Clone, Debug, Default)]
pub struct KvExprView<'a> {
    pub expr: ::core::option::Option<kv_expr::ExprView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> KvExprView<'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(kv_expr::ExprView::Field(ref mut existing)) = view.expr {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::Field(
                                ::buffa::alloc::boxed::Box::new(
                                    KvFieldRefView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                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)?;
                    if let Some(kv_expr::ExprView::Literal(ref mut existing)) = view.expr
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::Literal(
                                ::buffa::alloc::boxed::Box::new(
                                    KvReducedValueView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                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)?;
                    if let Some(kv_expr::ExprView::Add(ref mut existing)) = view.expr {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::Add(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_expr::BinaryExprView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                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)?;
                    if let Some(kv_expr::ExprView::Sub(ref mut existing)) = view.expr {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::Sub(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_expr::BinaryExprView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                5u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 5u32,
                            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(kv_expr::ExprView::Mul(ref mut existing)) = view.expr {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::Mul(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_expr::BinaryExprView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                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,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(kv_expr::ExprView::Div(ref mut existing)) = view.expr {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::Div(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_expr::BinaryExprView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                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,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(kv_expr::ExprView::Lower(ref mut existing)) = view.expr {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::Lower(
                                ::buffa::alloc::boxed::Box::new(
                                    KvExprView::_decode_depth(sub, depth - 1)?,
                                ),
                            ),
                        );
                    }
                }
                8u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 8u32,
                            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(kv_expr::ExprView::DateTruncDay(ref mut existing)) = view
                        .expr
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.expr = Some(
                            kv_expr::ExprView::DateTruncDay(
                                ::buffa::alloc::boxed::Box::new(
                                    KvExprView::_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 KvExprView<'a> {
    type Owned = KvExpr;
    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) -> KvExpr {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        KvExpr {
            expr: self
                .expr
                .as_ref()
                .map(|v| match v {
                    kv_expr::ExprView::Field(v) => {
                        kv_expr::Expr::Field(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_expr::ExprView::Literal(v) => {
                        kv_expr::Expr::Literal(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_expr::ExprView::Add(v) => {
                        kv_expr::Expr::Add(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_expr::ExprView::Sub(v) => {
                        kv_expr::Expr::Sub(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_expr::ExprView::Mul(v) => {
                        kv_expr::Expr::Mul(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_expr::ExprView::Div(v) => {
                        kv_expr::Expr::Div(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_expr::ExprView::Lower(v) => {
                        kv_expr::Expr::Lower(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_expr::ExprView::DateTruncDay(v) => {
                        kv_expr::Expr::DateTruncDay(
                            ::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 KvExprView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvExprView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for KvExprView<'a> {
    type Static = KvExprView<'static>;
}
pub mod kv_expr {
    #[allow(unused_imports)]
    use super::*;
    /// Binary arithmetic operation on two sub-expressions.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct BinaryExpr {
        /// Field 1: `left`
        #[serde(
            rename = "left",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
        )]
        pub left: ::buffa::MessageField<KvExpr>,
        /// Field 2: `right`
        #[serde(
            rename = "right",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
        )]
        pub right: ::buffa::MessageField<KvExpr>,
        #[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 BinaryExpr {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("BinaryExpr")
                .field("left", &self.left)
                .field("right", &self.right)
                .finish()
        }
    }
    impl BinaryExpr {
        /// 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.query.v1.KvExpr.BinaryExpr";
    }
    unsafe impl ::buffa::DefaultInstance for BinaryExpr {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<BinaryExpr> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for BinaryExpr {
        /// 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.left.is_set() {
                let inner_size = self.left.compute_size();
                size
                    += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                        + inner_size;
            }
            if self.right.is_set() {
                let inner_size = self.right.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.left.is_set() {
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::encoding::encode_varint(self.left.cached_size() as u64, buf);
                self.left.write_to(buf);
            }
            if self.right.is_set() {
                ::buffa::encoding::Tag::new(
                        2u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::encoding::encode_varint(self.right.cached_size() as u64, buf);
                self.right.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::Message::merge_length_delimited(
                        self.left.get_or_insert_default(),
                        buf,
                        depth,
                    )?;
                }
                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::Message::merge_length_delimited(
                        self.right.get_or_insert_default(),
                        buf,
                        depth,
                    )?;
                }
                _ => {
                    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.left = ::buffa::MessageField::none();
            self.right = ::buffa::MessageField::none();
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for BinaryExpr {
        const PROTO_FQN: &'static str = "store.query.v1.KvExpr.BinaryExpr";
        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 BinaryExpr {
        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 __BINARY_EXPR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvExpr.BinaryExpr",
        to_json: ::buffa::type_registry::any_to_json::<BinaryExpr>,
        from_json: ::buffa::type_registry::any_from_json::<BinaryExpr>,
        is_wkt: false,
    };
    /// Binary arithmetic operation on two sub-expressions.
    #[derive(Clone, Debug, Default)]
    pub struct BinaryExprView<'a> {
        /// Field 1: `left`
        pub left: ::buffa::MessageFieldView<KvExprView<'a>>,
        /// Field 2: `right`
        pub right: ::buffa::MessageFieldView<KvExprView<'a>>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> BinaryExprView<'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)?;
                        match view.left.as_mut() {
                            Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                            None => {
                                view.left = ::buffa::MessageFieldView::set(
                                    KvExprView::_decode_depth(sub, depth - 1)?,
                                );
                            }
                        }
                    }
                    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)?;
                        match view.right.as_mut() {
                            Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                            None => {
                                view.right = ::buffa::MessageFieldView::set(
                                    KvExprView::_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 BinaryExprView<'a> {
        type Owned = BinaryExpr;
        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) -> BinaryExpr {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            BinaryExpr {
                left: match self.left.as_option() {
                    Some(v) => {
                        ::buffa::MessageField::<KvExpr>::some(v.to_owned_message())
                    }
                    None => ::buffa::MessageField::none(),
                },
                right: match self.right.as_option() {
                    Some(v) => {
                        ::buffa::MessageField::<KvExpr>::some(v.to_owned_message())
                    }
                    None => ::buffa::MessageField::none(),
                },
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for BinaryExprView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<BinaryExprView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for BinaryExprView<'a> {
        type Static = BinaryExprView<'static>;
    }
    #[derive(Clone, PartialEq, Debug)]
    pub enum Expr {
        Field(::buffa::alloc::boxed::Box<super::KvFieldRef>),
        Literal(::buffa::alloc::boxed::Box<super::KvReducedValue>),
        Add(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExpr>),
        Sub(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExpr>),
        Mul(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExpr>),
        Div(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExpr>),
        Lower(::buffa::alloc::boxed::Box<super::KvExpr>),
        DateTruncDay(::buffa::alloc::boxed::Box<super::KvExpr>),
    }
    impl ::buffa::Oneof for Expr {}
    impl From<super::KvFieldRef> for Expr {
        fn from(v: super::KvFieldRef) -> Self {
            Self::Field(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::KvFieldRef> for ::core::option::Option<Expr> {
        fn from(v: super::KvFieldRef) -> Self {
            Self::Some(Expr::from(v))
        }
    }
    impl From<super::KvReducedValue> for Expr {
        fn from(v: super::KvReducedValue) -> Self {
            Self::Literal(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::KvReducedValue> for ::core::option::Option<Expr> {
        fn from(v: super::KvReducedValue) -> Self {
            Self::Some(Expr::from(v))
        }
    }
    impl serde::Serialize for Expr {
        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 {
                Expr::Field(v) => {
                    map.serialize_entry("field", v)?;
                }
                Expr::Literal(v) => {
                    map.serialize_entry("literal", v)?;
                }
                Expr::Add(v) => {
                    map.serialize_entry("add", v)?;
                }
                Expr::Sub(v) => {
                    map.serialize_entry("sub", v)?;
                }
                Expr::Mul(v) => {
                    map.serialize_entry("mul", v)?;
                }
                Expr::Div(v) => {
                    map.serialize_entry("div", v)?;
                }
                Expr::Lower(v) => {
                    map.serialize_entry("lower", v)?;
                }
                Expr::DateTruncDay(v) => {
                    map.serialize_entry("dateTruncDay", v)?;
                }
            }
            map.end()
        }
    }
    #[derive(Clone, Debug)]
    pub enum ExprView<'a> {
        Field(::buffa::alloc::boxed::Box<super::KvFieldRefView<'a>>),
        Literal(::buffa::alloc::boxed::Box<super::KvReducedValueView<'a>>),
        Add(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExprView<'a>>),
        Sub(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExprView<'a>>),
        Mul(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExprView<'a>>),
        Div(::buffa::alloc::boxed::Box<super::kv_expr::BinaryExprView<'a>>),
        Lower(::buffa::alloc::boxed::Box<super::KvExprView<'a>>),
        DateTruncDay(::buffa::alloc::boxed::Box<super::KvExprView<'a>>),
    }
}
/// A constraint applied to a single field value during predicate evaluation.
/// Exactly one variant must be set.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct KvPredicateConstraint {
    #[serde(flatten)]
    pub constraint: Option<kv_predicate_constraint::Constraint>,
    #[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 KvPredicateConstraint {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("KvPredicateConstraint")
            .field("constraint", &self.constraint)
            .finish()
    }
}
impl KvPredicateConstraint {
    /// 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.query.v1.KvPredicateConstraint";
}
unsafe impl ::buffa::DefaultInstance for KvPredicateConstraint {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvPredicateConstraint> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for KvPredicateConstraint {
    /// 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.constraint {
            match v {
                kv_predicate_constraint::Constraint::StringEq(x) => {
                    size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
                }
                kv_predicate_constraint::Constraint::BoolEq(_x) => {
                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
                }
                kv_predicate_constraint::Constraint::FixedSizeBinaryEq(x) => {
                    size += 1u32 + ::buffa::types::bytes_encoded_len(x) as u32;
                }
                kv_predicate_constraint::Constraint::IntRange(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::Uint64Range(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::FloatRange(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::Decimal128Range(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::IsNull(_x) => {
                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
                }
                kv_predicate_constraint::Constraint::IsNotNull(_x) => {
                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
                }
                kv_predicate_constraint::Constraint::StringIn(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::IntIn(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::Uint64In(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::FixedSizeBinaryIn(x) => {
                    let inner = x.compute_size();
                    size
                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
                            + inner;
                }
                kv_predicate_constraint::Constraint::Decimal256Range(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.constraint {
            match v {
                kv_predicate_constraint::Constraint::StringEq(x) => {
                    ::buffa::encoding::Tag::new(
                            1u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_string(x, buf);
                }
                kv_predicate_constraint::Constraint::BoolEq(x) => {
                    ::buffa::encoding::Tag::new(
                            2u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bool(*x, buf);
                }
                kv_predicate_constraint::Constraint::FixedSizeBinaryEq(x) => {
                    ::buffa::encoding::Tag::new(
                            3u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bytes(x, buf);
                }
                kv_predicate_constraint::Constraint::IntRange(x) => {
                    ::buffa::encoding::Tag::new(
                            4u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_predicate_constraint::Constraint::Uint64Range(x) => {
                    ::buffa::encoding::Tag::new(
                            5u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_predicate_constraint::Constraint::FloatRange(x) => {
                    ::buffa::encoding::Tag::new(
                            6u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_predicate_constraint::Constraint::Decimal128Range(x) => {
                    ::buffa::encoding::Tag::new(
                            7u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_predicate_constraint::Constraint::IsNull(x) => {
                    ::buffa::encoding::Tag::new(
                            8u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bool(*x, buf);
                }
                kv_predicate_constraint::Constraint::IsNotNull(x) => {
                    ::buffa::encoding::Tag::new(
                            9u32,
                            ::buffa::encoding::WireType::Varint,
                        )
                        .encode(buf);
                    ::buffa::types::encode_bool(*x, buf);
                }
                kv_predicate_constraint::Constraint::StringIn(x) => {
                    ::buffa::encoding::Tag::new(
                            10u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_predicate_constraint::Constraint::IntIn(x) => {
                    ::buffa::encoding::Tag::new(
                            11u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_predicate_constraint::Constraint::Uint64In(x) => {
                    ::buffa::encoding::Tag::new(
                            12u32,
                            ::buffa::encoding::WireType::LengthDelimited,
                        )
                        .encode(buf);
                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
                    x.write_to(buf);
                }
                kv_predicate_constraint::Constraint::FixedSizeBinaryIn(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);
                }
                kv_predicate_constraint::Constraint::Decimal256Range(x) => {
                    ::buffa::encoding::Tag::new(
                            14u32,
                            ::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,
                    });
                }
                self.constraint = ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::StringEq(
                        ::buffa::types::decode_string(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.constraint = ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::BoolEq(
                        ::buffa::types::decode_bool(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,
                    });
                }
                self.constraint = ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::FixedSizeBinaryEq(
                        ::buffa::types::decode_bytes(buf)?,
                    ),
                );
            }
            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 let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::IntRange(ref mut existing),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::IntRange(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            5u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 5u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::Uint64Range(ref mut existing),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::Uint64Range(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            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,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::FloatRange(ref mut existing),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::FloatRange(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            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,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::Decimal128Range(
                        ref mut existing,
                    ),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::Decimal128Range(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            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.constraint = ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::IsNull(
                        ::buffa::types::decode_bool(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.constraint = ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::IsNotNull(
                        ::buffa::types::decode_bool(buf)?,
                    ),
                );
            }
            10u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 10u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::StringIn(ref mut existing),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::StringIn(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            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,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::IntIn(ref mut existing),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::IntIn(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            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,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::Uint64In(ref mut existing),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::Uint64In(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            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(
                    kv_predicate_constraint::Constraint::FixedSizeBinaryIn(
                        ref mut existing,
                    ),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::FixedSizeBinaryIn(
                            ::buffa::alloc::boxed::Box::new(val),
                        ),
                    );
                }
            }
            14u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 14u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                if let ::core::option::Option::Some(
                    kv_predicate_constraint::Constraint::Decimal256Range(
                        ref mut existing,
                    ),
                ) = self.constraint
                {
                    ::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.constraint = ::core::option::Option::Some(
                        kv_predicate_constraint::Constraint::Decimal256Range(
                            ::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.constraint = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for KvPredicateConstraint {
    const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint";
    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 KvPredicateConstraint {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct _V;
        impl<'de> serde::de::Visitor<'de> for _V {
            type Value = KvPredicateConstraint;
            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
                f.write_str("struct KvPredicateConstraint")
            }
            #[allow(clippy::field_reassign_with_default)]
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                mut map: A,
            ) -> Result<KvPredicateConstraint, A::Error> {
                let mut __oneof_constraint: Option<
                    kv_predicate_constraint::Constraint,
                > = None;
                while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
                    match key.as_str() {
                        "stringEq" | "string_eq" => {
                            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_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::StringEq(v),
                                );
                            }
                        }
                        "boolEq" | "bool_eq" => {
                            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_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::BoolEq(v),
                                );
                            }
                        }
                        "fixedSizeBinaryEq" | "fixed_size_binary_eq" => {
                            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_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::FixedSizeBinaryEq(v),
                                );
                            }
                        }
                        "intRange" | "int_range" => {
                            let v: Option<kv_predicate_constraint::IntRange> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::IntRange,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::IntRange(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "uint64Range" | "uint64_range" => {
                            let v: Option<kv_predicate_constraint::UInt64Range> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::UInt64Range,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::Uint64Range(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "floatRange" | "float_range" => {
                            let v: Option<kv_predicate_constraint::FloatRange> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::FloatRange,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::FloatRange(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "decimal128Range" | "decimal128_range" => {
                            let v: Option<kv_predicate_constraint::Decimal128Range> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::Decimal128Range,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::Decimal128Range(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "isNull" | "is_null" => {
                            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_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::IsNull(v),
                                );
                            }
                        }
                        "isNotNull" | "is_not_null" => {
                            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_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::IsNotNull(v),
                                );
                            }
                        }
                        "stringIn" | "string_in" => {
                            let v: Option<kv_predicate_constraint::StringIn> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::StringIn,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::StringIn(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "intIn" | "int_in" => {
                            let v: Option<kv_predicate_constraint::IntIn> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::IntIn,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::IntIn(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "uint64In" | "uint64_in" => {
                            let v: Option<kv_predicate_constraint::UInt64In> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::UInt64In,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::Uint64In(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "fixedSizeBinaryIn" | "fixed_size_binary_in" => {
                            let v: Option<kv_predicate_constraint::FixedSizeBinaryIn> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::FixedSizeBinaryIn,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::FixedSizeBinaryIn(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        "decimal256Range" | "decimal256_range" => {
                            let v: Option<kv_predicate_constraint::Decimal256Range> = map
                                .next_value_seed(
                                    ::buffa::json_helpers::NullableDeserializeSeed(
                                        ::buffa::json_helpers::DefaultDeserializeSeed::<
                                            kv_predicate_constraint::Decimal256Range,
                                        >::new(),
                                    ),
                                )?;
                            if let Some(v) = v {
                                if __oneof_constraint.is_some() {
                                    return Err(
                                        serde::de::Error::custom(
                                            "multiple oneof fields set for 'constraint'",
                                        ),
                                    );
                                }
                                __oneof_constraint = Some(
                                    kv_predicate_constraint::Constraint::Decimal256Range(
                                        ::buffa::alloc::boxed::Box::new(v),
                                    ),
                                );
                            }
                        }
                        _ => {
                            map.next_value::<serde::de::IgnoredAny>()?;
                        }
                    }
                }
                let mut __r = <KvPredicateConstraint as ::core::default::Default>::default();
                __r.constraint = __oneof_constraint;
                Ok(__r)
            }
        }
        d.deserialize_map(_V)
    }
}
impl ::buffa::json_helpers::ProtoElemJson for KvPredicateConstraint {
    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 __KV_PREDICATE_CONSTRAINT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint",
    to_json: ::buffa::type_registry::any_to_json::<KvPredicateConstraint>,
    from_json: ::buffa::type_registry::any_from_json::<KvPredicateConstraint>,
    is_wkt: false,
};
/// A constraint applied to a single field value during predicate evaluation.
/// Exactly one variant must be set.
#[derive(Clone, Debug, Default)]
pub struct KvPredicateConstraintView<'a> {
    pub constraint: ::core::option::Option<kv_predicate_constraint::ConstraintView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> KvPredicateConstraintView<'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.constraint = Some(
                        kv_predicate_constraint::ConstraintView::StringEq(
                            ::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.constraint = Some(
                        kv_predicate_constraint::ConstraintView::BoolEq(
                            ::buffa::types::decode_bool(&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,
                        });
                    }
                    view.constraint = Some(
                        kv_predicate_constraint::ConstraintView::FixedSizeBinaryEq(
                            ::buffa::types::borrow_bytes(&mut cur)?,
                        ),
                    );
                }
                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)?;
                    if let Some(
                        kv_predicate_constraint::ConstraintView::IntRange(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::IntRange(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::IntRangeView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                5u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 5u32,
                            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(
                        kv_predicate_constraint::ConstraintView::Uint64Range(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::Uint64Range(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::UInt64RangeView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                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,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(
                        kv_predicate_constraint::ConstraintView::FloatRange(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::FloatRange(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::FloatRangeView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                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,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(
                        kv_predicate_constraint::ConstraintView::Decimal128Range(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::Decimal128Range(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::Decimal128RangeView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                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.constraint = Some(
                        kv_predicate_constraint::ConstraintView::IsNull(
                            ::buffa::types::decode_bool(&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.constraint = Some(
                        kv_predicate_constraint::ConstraintView::IsNotNull(
                            ::buffa::types::decode_bool(&mut cur)?,
                        ),
                    );
                }
                10u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 10u32,
                            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(
                        kv_predicate_constraint::ConstraintView::StringIn(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::StringIn(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::StringInView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                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,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(
                        kv_predicate_constraint::ConstraintView::IntIn(ref mut existing),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::IntIn(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::IntInView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                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,
                        });
                    }
                    if depth == 0 {
                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
                    }
                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
                    if let Some(
                        kv_predicate_constraint::ConstraintView::Uint64In(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::Uint64In(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::UInt64InView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                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(
                        kv_predicate_constraint::ConstraintView::FixedSizeBinaryIn(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::FixedSizeBinaryIn(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::FixedSizeBinaryInView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                ),
                            ),
                        );
                    }
                }
                14u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 14u32,
                            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(
                        kv_predicate_constraint::ConstraintView::Decimal256Range(
                            ref mut existing,
                        ),
                    ) = view.constraint
                    {
                        existing._merge_into_view(sub, depth - 1)?;
                    } else {
                        view.constraint = Some(
                            kv_predicate_constraint::ConstraintView::Decimal256Range(
                                ::buffa::alloc::boxed::Box::new(
                                    kv_predicate_constraint::Decimal256RangeView::_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 KvPredicateConstraintView<'a> {
    type Owned = KvPredicateConstraint;
    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) -> KvPredicateConstraint {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        KvPredicateConstraint {
            constraint: self
                .constraint
                .as_ref()
                .map(|v| match v {
                    kv_predicate_constraint::ConstraintView::StringEq(v) => {
                        kv_predicate_constraint::Constraint::StringEq(v.to_string())
                    }
                    kv_predicate_constraint::ConstraintView::BoolEq(v) => {
                        kv_predicate_constraint::Constraint::BoolEq(*v)
                    }
                    kv_predicate_constraint::ConstraintView::FixedSizeBinaryEq(v) => {
                        kv_predicate_constraint::Constraint::FixedSizeBinaryEq(
                            (v).to_vec(),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::IntRange(v) => {
                        kv_predicate_constraint::Constraint::IntRange(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::Uint64Range(v) => {
                        kv_predicate_constraint::Constraint::Uint64Range(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::FloatRange(v) => {
                        kv_predicate_constraint::Constraint::FloatRange(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::Decimal128Range(v) => {
                        kv_predicate_constraint::Constraint::Decimal128Range(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::IsNull(v) => {
                        kv_predicate_constraint::Constraint::IsNull(*v)
                    }
                    kv_predicate_constraint::ConstraintView::IsNotNull(v) => {
                        kv_predicate_constraint::Constraint::IsNotNull(*v)
                    }
                    kv_predicate_constraint::ConstraintView::StringIn(v) => {
                        kv_predicate_constraint::Constraint::StringIn(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::IntIn(v) => {
                        kv_predicate_constraint::Constraint::IntIn(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::Uint64In(v) => {
                        kv_predicate_constraint::Constraint::Uint64In(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::FixedSizeBinaryIn(v) => {
                        kv_predicate_constraint::Constraint::FixedSizeBinaryIn(
                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
                        )
                    }
                    kv_predicate_constraint::ConstraintView::Decimal256Range(v) => {
                        kv_predicate_constraint::Constraint::Decimal256Range(
                            ::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 KvPredicateConstraintView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvPredicateConstraintView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for KvPredicateConstraintView<'a> {
    type Static = KvPredicateConstraintView<'static>;
}
pub mod kv_predicate_constraint {
    #[allow(unused_imports)]
    use super::*;
    /// Inclusive integer range. Omit `min` or `max` for a one-sided bound.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct IntRange {
        /// Field 1: `min`
        #[serde(
            rename = "min",
            with = "::buffa::json_helpers::opt_int64",
            skip_serializing_if = "Option::is_none"
        )]
        pub min: Option<i64>,
        /// Field 2: `max`
        #[serde(
            rename = "max",
            with = "::buffa::json_helpers::opt_int64",
            skip_serializing_if = "Option::is_none"
        )]
        pub max: Option<i64>,
        #[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 IntRange {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("IntRange")
                .field("min", &self.min)
                .field("max", &self.max)
                .finish()
        }
    }
    impl IntRange {
        /// 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.query.v1.KvPredicateConstraint.IntRange";
    }
    unsafe impl ::buffa::DefaultInstance for IntRange {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<IntRange> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for IntRange {
        /// 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 Some(v) = self.min {
                size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
            }
            if let Some(v) = self.max {
                size += 1u32 + ::buffa::types::int64_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 let Some(v) = self.min {
                ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_int64(v, buf);
            }
            if let Some(v) = self.max {
                ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_int64(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::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    self.min = ::core::option::Option::Some(
                        ::buffa::types::decode_int64(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.max = ::core::option::Option::Some(
                        ::buffa::types::decode_int64(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.min = ::core::option::Option::None;
            self.max = ::core::option::Option::None;
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for IntRange {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.IntRange";
        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 IntRange {
        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 __INT_RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.IntRange",
        to_json: ::buffa::type_registry::any_to_json::<IntRange>,
        from_json: ::buffa::type_registry::any_from_json::<IntRange>,
        is_wkt: false,
    };
    /// Inclusive integer range. Omit `min` or `max` for a one-sided bound.
    #[derive(Clone, Debug, Default)]
    pub struct IntRangeView<'a> {
        /// Field 1: `min`
        pub min: ::core::option::Option<i64>,
        /// Field 2: `max`
        pub max: ::core::option::Option<i64>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> IntRangeView<'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.min = Some(::buffa::types::decode_int64(&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.max = Some(::buffa::types::decode_int64(&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 IntRangeView<'a> {
        type Owned = IntRange;
        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) -> IntRange {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            IntRange {
                min: self.min,
                max: self.max,
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for IntRangeView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<IntRangeView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for IntRangeView<'a> {
        type Static = IntRangeView<'static>;
    }
    /// Inclusive uint64 range. Omit `min` or `max` for a one-sided bound.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct UInt64Range {
        /// Field 1: `min`
        #[serde(
            rename = "min",
            with = "::buffa::json_helpers::opt_uint64",
            skip_serializing_if = "Option::is_none"
        )]
        pub min: Option<u64>,
        /// Field 2: `max`
        #[serde(
            rename = "max",
            with = "::buffa::json_helpers::opt_uint64",
            skip_serializing_if = "Option::is_none"
        )]
        pub max: 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 UInt64Range {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("UInt64Range")
                .field("min", &self.min)
                .field("max", &self.max)
                .finish()
        }
    }
    impl UInt64Range {
        /// 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.query.v1.KvPredicateConstraint.UInt64Range";
    }
    unsafe impl ::buffa::DefaultInstance for UInt64Range {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<UInt64Range> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for UInt64Range {
        /// 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 Some(v) = self.min {
                size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
            }
            if let Some(v) = self.max {
                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 let Some(v) = self.min {
                ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_uint64(v, buf);
            }
            if let Some(v) = self.max {
                ::buffa::encoding::Tag::new(2u32, ::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::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    self.min = ::core::option::Option::Some(
                        ::buffa::types::decode_uint64(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.max = ::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.min = ::core::option::Option::None;
            self.max = ::core::option::Option::None;
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for UInt64Range {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.UInt64Range";
        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 UInt64Range {
        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 __U_INT64RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.UInt64Range",
        to_json: ::buffa::type_registry::any_to_json::<UInt64Range>,
        from_json: ::buffa::type_registry::any_from_json::<UInt64Range>,
        is_wkt: false,
    };
    /// Inclusive uint64 range. Omit `min` or `max` for a one-sided bound.
    #[derive(Clone, Debug, Default)]
    pub struct UInt64RangeView<'a> {
        /// Field 1: `min`
        pub min: ::core::option::Option<u64>,
        /// Field 2: `max`
        pub max: ::core::option::Option<u64>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> UInt64RangeView<'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.min = Some(::buffa::types::decode_uint64(&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.max = 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 UInt64RangeView<'a> {
        type Owned = UInt64Range;
        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) -> UInt64Range {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            UInt64Range {
                min: self.min,
                max: self.max,
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for UInt64RangeView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<UInt64RangeView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for UInt64RangeView<'a> {
        type Static = UInt64RangeView<'static>;
    }
    /// A single bound for a float range, with an inclusivity flag.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct FloatBound {
        /// Field 1: `value`
        #[serde(
            rename = "value",
            with = "::buffa::json_helpers::double",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_f64"
        )]
        pub value: f64,
        /// When true the bound includes `value` itself (\<=/\>= semantics).
        ///
        /// Field 2: `inclusive`
        #[serde(
            rename = "inclusive",
            with = "::buffa::json_helpers::proto_bool",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
        )]
        pub inclusive: 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 FloatBound {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("FloatBound")
                .field("value", &self.value)
                .field("inclusive", &self.inclusive)
                .finish()
        }
    }
    impl FloatBound {
        /// 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.query.v1.KvPredicateConstraint.FloatBound";
    }
    unsafe impl ::buffa::DefaultInstance for FloatBound {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<FloatBound> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for FloatBound {
        /// 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.value.to_bits() != 0u64 {
                size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
            }
            if self.inclusive {
                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.value.to_bits() != 0u64 {
                ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Fixed64)
                    .encode(buf);
                ::buffa::types::encode_double(self.value, buf);
            }
            if self.inclusive {
                ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_bool(self.inclusive, 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::Fixed64 {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            expected: 1u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    self.value = ::buffa::types::decode_double(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.inclusive = ::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.value = 0f64;
            self.inclusive = false;
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for FloatBound {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.FloatBound";
        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 FloatBound {
        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 __FLOAT_BOUND_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.FloatBound",
        to_json: ::buffa::type_registry::any_to_json::<FloatBound>,
        from_json: ::buffa::type_registry::any_from_json::<FloatBound>,
        is_wkt: false,
    };
    /// A single bound for a float range, with an inclusivity flag.
    #[derive(Clone, Debug, Default)]
    pub struct FloatBoundView<'a> {
        /// Field 1: `value`
        pub value: f64,
        /// When true the bound includes `value` itself (\<=/\>= semantics).
        ///
        /// Field 2: `inclusive`
        pub inclusive: bool,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> FloatBoundView<'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::Fixed64 {
                            return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                                field_number: 1u32,
                                expected: 1u8,
                                actual: tag.wire_type() as u8,
                            });
                        }
                        view.value = ::buffa::types::decode_double(&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.inclusive = ::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 FloatBoundView<'a> {
        type Owned = FloatBound;
        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) -> FloatBound {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            FloatBound {
                value: self.value,
                inclusive: self.inclusive,
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for FloatBoundView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<FloatBoundView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for FloatBoundView<'a> {
        type Static = FloatBoundView<'static>;
    }
    /// Float range with independently inclusive/exclusive bounds.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct FloatRange {
        /// Field 1: `min`
        #[serde(
            rename = "min",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
        )]
        pub min: ::buffa::MessageField<kv_predicate_constraint::FloatBound>,
        /// Field 2: `max`
        #[serde(
            rename = "max",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
        )]
        pub max: ::buffa::MessageField<kv_predicate_constraint::FloatBound>,
        #[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 FloatRange {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("FloatRange")
                .field("min", &self.min)
                .field("max", &self.max)
                .finish()
        }
    }
    impl FloatRange {
        /// 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.query.v1.KvPredicateConstraint.FloatRange";
    }
    unsafe impl ::buffa::DefaultInstance for FloatRange {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<FloatRange> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for FloatRange {
        /// 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.min.is_set() {
                let inner_size = self.min.compute_size();
                size
                    += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                        + inner_size;
            }
            if self.max.is_set() {
                let inner_size = self.max.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.min.is_set() {
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::encoding::encode_varint(self.min.cached_size() as u64, buf);
                self.min.write_to(buf);
            }
            if self.max.is_set() {
                ::buffa::encoding::Tag::new(
                        2u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::encoding::encode_varint(self.max.cached_size() as u64, buf);
                self.max.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::Message::merge_length_delimited(
                        self.min.get_or_insert_default(),
                        buf,
                        depth,
                    )?;
                }
                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::Message::merge_length_delimited(
                        self.max.get_or_insert_default(),
                        buf,
                        depth,
                    )?;
                }
                _ => {
                    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.min = ::buffa::MessageField::none();
            self.max = ::buffa::MessageField::none();
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for FloatRange {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.FloatRange";
        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 FloatRange {
        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 __FLOAT_RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.FloatRange",
        to_json: ::buffa::type_registry::any_to_json::<FloatRange>,
        from_json: ::buffa::type_registry::any_from_json::<FloatRange>,
        is_wkt: false,
    };
    /// Float range with independently inclusive/exclusive bounds.
    #[derive(Clone, Debug, Default)]
    pub struct FloatRangeView<'a> {
        /// Field 1: `min`
        pub min: ::buffa::MessageFieldView<kv_predicate_constraint::FloatBoundView<'a>>,
        /// Field 2: `max`
        pub max: ::buffa::MessageFieldView<kv_predicate_constraint::FloatBoundView<'a>>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> FloatRangeView<'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)?;
                        match view.min.as_mut() {
                            Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                            None => {
                                view.min = ::buffa::MessageFieldView::set(
                                    kv_predicate_constraint::FloatBoundView::_decode_depth(
                                        sub,
                                        depth - 1,
                                    )?,
                                );
                            }
                        }
                    }
                    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)?;
                        match view.max.as_mut() {
                            Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                            None => {
                                view.max = ::buffa::MessageFieldView::set(
                                    kv_predicate_constraint::FloatBoundView::_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 FloatRangeView<'a> {
        type Owned = FloatRange;
        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) -> FloatRange {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            FloatRange {
                min: match self.min.as_option() {
                    Some(v) => {
                        ::buffa::MessageField::<
                            kv_predicate_constraint::FloatBound,
                        >::some(v.to_owned_message())
                    }
                    None => ::buffa::MessageField::none(),
                },
                max: match self.max.as_option() {
                    Some(v) => {
                        ::buffa::MessageField::<
                            kv_predicate_constraint::FloatBound,
                        >::some(v.to_owned_message())
                    }
                    None => ::buffa::MessageField::none(),
                },
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for FloatRangeView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<FloatRangeView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for FloatRangeView<'a> {
        type Static = FloatRangeView<'static>;
    }
    /// Inclusive Decimal128 range (16-byte little-endian).
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct Decimal128Range {
        /// Field 1: `min`
        #[serde(
            rename = "min",
            with = "::buffa::json_helpers::opt_bytes",
            skip_serializing_if = "Option::is_none"
        )]
        pub min: Option<::buffa::alloc::vec::Vec<u8>>,
        /// Field 2: `max`
        #[serde(
            rename = "max",
            with = "::buffa::json_helpers::opt_bytes",
            skip_serializing_if = "Option::is_none"
        )]
        pub max: Option<::buffa::alloc::vec::Vec<u8>>,
        #[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 Decimal128Range {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("Decimal128Range")
                .field("min", &self.min)
                .field("max", &self.max)
                .finish()
        }
    }
    impl Decimal128Range {
        /// 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.query.v1.KvPredicateConstraint.Decimal128Range";
    }
    unsafe impl ::buffa::DefaultInstance for Decimal128Range {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<Decimal128Range> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for Decimal128Range {
        /// 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 Some(ref v) = self.min {
                size += 1u32 + ::buffa::types::bytes_encoded_len(v) as u32;
            }
            if let Some(ref v) = self.max {
                size += 1u32 + ::buffa::types::bytes_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 let Some(ref v) = self.min {
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::types::encode_bytes(v, buf);
            }
            if let Some(ref v) = self.max {
                ::buffa::encoding::Tag::new(
                        2u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::types::encode_bytes(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_bytes(
                        self.min.get_or_insert_with(::buffa::alloc::vec::Vec::new),
                        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_bytes(
                        self.max.get_or_insert_with(::buffa::alloc::vec::Vec::new),
                        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.min = ::core::option::Option::None;
            self.max = ::core::option::Option::None;
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for Decimal128Range {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.Decimal128Range";
        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 Decimal128Range {
        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 __DECIMAL128RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.Decimal128Range",
        to_json: ::buffa::type_registry::any_to_json::<Decimal128Range>,
        from_json: ::buffa::type_registry::any_from_json::<Decimal128Range>,
        is_wkt: false,
    };
    /// Inclusive Decimal128 range (16-byte little-endian).
    #[derive(Clone, Debug, Default)]
    pub struct Decimal128RangeView<'a> {
        /// Field 1: `min`
        pub min: ::core::option::Option<&'a [u8]>,
        /// Field 2: `max`
        pub max: ::core::option::Option<&'a [u8]>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> Decimal128RangeView<'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.min = Some(::buffa::types::borrow_bytes(&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.max = Some(::buffa::types::borrow_bytes(&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 Decimal128RangeView<'a> {
        type Owned = Decimal128Range;
        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) -> Decimal128Range {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            Decimal128Range {
                min: self.min.map(|b| (b).to_vec()),
                max: self.max.map(|b| (b).to_vec()),
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for Decimal128RangeView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<Decimal128RangeView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for Decimal128RangeView<'a> {
        type Static = Decimal128RangeView<'static>;
    }
    /// Inclusive Decimal256 range (32-byte little-endian).
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct Decimal256Range {
        /// Field 1: `min`
        #[serde(
            rename = "min",
            with = "::buffa::json_helpers::opt_bytes",
            skip_serializing_if = "Option::is_none"
        )]
        pub min: Option<::buffa::alloc::vec::Vec<u8>>,
        /// Field 2: `max`
        #[serde(
            rename = "max",
            with = "::buffa::json_helpers::opt_bytes",
            skip_serializing_if = "Option::is_none"
        )]
        pub max: Option<::buffa::alloc::vec::Vec<u8>>,
        #[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 Decimal256Range {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("Decimal256Range")
                .field("min", &self.min)
                .field("max", &self.max)
                .finish()
        }
    }
    impl Decimal256Range {
        /// 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.query.v1.KvPredicateConstraint.Decimal256Range";
    }
    unsafe impl ::buffa::DefaultInstance for Decimal256Range {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<Decimal256Range> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for Decimal256Range {
        /// 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 Some(ref v) = self.min {
                size += 1u32 + ::buffa::types::bytes_encoded_len(v) as u32;
            }
            if let Some(ref v) = self.max {
                size += 1u32 + ::buffa::types::bytes_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 let Some(ref v) = self.min {
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::types::encode_bytes(v, buf);
            }
            if let Some(ref v) = self.max {
                ::buffa::encoding::Tag::new(
                        2u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::types::encode_bytes(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_bytes(
                        self.min.get_or_insert_with(::buffa::alloc::vec::Vec::new),
                        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_bytes(
                        self.max.get_or_insert_with(::buffa::alloc::vec::Vec::new),
                        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.min = ::core::option::Option::None;
            self.max = ::core::option::Option::None;
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for Decimal256Range {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.Decimal256Range";
        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 Decimal256Range {
        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 __DECIMAL256RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.Decimal256Range",
        to_json: ::buffa::type_registry::any_to_json::<Decimal256Range>,
        from_json: ::buffa::type_registry::any_from_json::<Decimal256Range>,
        is_wkt: false,
    };
    /// Inclusive Decimal256 range (32-byte little-endian).
    #[derive(Clone, Debug, Default)]
    pub struct Decimal256RangeView<'a> {
        /// Field 1: `min`
        pub min: ::core::option::Option<&'a [u8]>,
        /// Field 2: `max`
        pub max: ::core::option::Option<&'a [u8]>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> Decimal256RangeView<'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.min = Some(::buffa::types::borrow_bytes(&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.max = Some(::buffa::types::borrow_bytes(&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 Decimal256RangeView<'a> {
        type Owned = Decimal256Range;
        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) -> Decimal256Range {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            Decimal256Range {
                min: self.min.map(|b| (b).to_vec()),
                max: self.max.map(|b| (b).to_vec()),
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for Decimal256RangeView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<Decimal256RangeView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for Decimal256RangeView<'a> {
        type Static = Decimal256RangeView<'static>;
    }
    /// Set membership test for UTF-8 strings.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct StringIn {
        /// Field 1: `values`
        #[serde(
            rename = "values",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
            deserialize_with = "::buffa::json_helpers::null_as_default"
        )]
        pub values: ::buffa::alloc::vec::Vec<::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 StringIn {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("StringIn").field("values", &self.values).finish()
        }
    }
    impl StringIn {
        /// 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.query.v1.KvPredicateConstraint.StringIn";
    }
    unsafe impl ::buffa::DefaultInstance for StringIn {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<StringIn> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for StringIn {
        /// 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.values {
                size += 1u32 + ::buffa::types::string_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 _;
            for v in &self.values {
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::types::encode_string(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,
                        });
                    }
                    self.values.push(::buffa::types::decode_string(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.values.clear();
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for StringIn {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.StringIn";
        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 StringIn {
        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 __STRING_IN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.StringIn",
        to_json: ::buffa::type_registry::any_to_json::<StringIn>,
        from_json: ::buffa::type_registry::any_from_json::<StringIn>,
        is_wkt: false,
    };
    /// Set membership test for UTF-8 strings.
    #[derive(Clone, Debug, Default)]
    pub struct StringInView<'a> {
        /// Field 1: `values`
        pub values: ::buffa::RepeatedView<'a, &'a str>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> StringInView<'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.values.push(::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 StringInView<'a> {
        type Owned = StringIn;
        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) -> StringIn {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            StringIn {
                values: self.values.iter().map(|s| s.to_string()).collect(),
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for StringInView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<StringInView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for StringInView<'a> {
        type Static = StringInView<'static>;
    }
    /// Set membership test for int64 values.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct IntIn {
        /// Field 1: `values`
        #[serde(
            rename = "values",
            with = "::buffa::json_helpers::proto_seq",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
        )]
        pub values: ::buffa::alloc::vec::Vec<i64>,
        #[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 IntIn {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("IntIn").field("values", &self.values).finish()
        }
    }
    impl IntIn {
        /// 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.query.v1.KvPredicateConstraint.IntIn";
    }
    unsafe impl ::buffa::DefaultInstance for IntIn {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<IntIn> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for IntIn {
        /// 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.values.is_empty() {
                let payload: u32 = self
                    .values
                    .iter()
                    .map(|&v| ::buffa::types::int64_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.values.is_empty() {
                let payload: u32 = self
                    .values
                    .iter()
                    .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
                    .sum::<u32>();
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::encoding::encode_varint(payload as u64, buf);
                for &v in &self.values {
                    ::buffa::types::encode_int64(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 {
                        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.values.reserve(len);
                        let mut limited = buf.take(len);
                        while limited.has_remaining() {
                            self.values
                                .push(::buffa::types::decode_int64(&mut limited)?);
                        }
                        let leftover = limited.remaining();
                        if leftover > 0 {
                            limited.advance(leftover);
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        self.values.push(::buffa::types::decode_int64(buf)?);
                    } else {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            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.values.clear();
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for IntIn {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.IntIn";
        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 IntIn {
        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 __INT_IN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.IntIn",
        to_json: ::buffa::type_registry::any_to_json::<IntIn>,
        from_json: ::buffa::type_registry::any_from_json::<IntIn>,
        is_wkt: false,
    };
    /// Set membership test for int64 values.
    #[derive(Clone, Debug, Default)]
    pub struct IntInView<'a> {
        /// Field 1: `values`
        pub values: ::buffa::RepeatedView<'a, i64>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> IntInView<'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
                        {
                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
                            let mut pcur: &[u8] = payload;
                            while !pcur.is_empty() {
                                view.values.push(::buffa::types::decode_int64(&mut pcur)?);
                            }
                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
                        {
                            view.values.push(::buffa::types::decode_int64(&mut cur)?);
                        } else {
                            return Err(::buffa::DecodeError::WireTypeMismatch {
                                field_number: 1u32,
                                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 IntInView<'a> {
        type Owned = IntIn;
        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) -> IntIn {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            IntIn {
                values: self.values.to_vec(),
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for IntInView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<IntInView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for IntInView<'a> {
        type Static = IntInView<'static>;
    }
    /// Set membership test for uint64 values.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct UInt64In {
        /// Field 1: `values`
        #[serde(
            rename = "values",
            with = "::buffa::json_helpers::proto_seq",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
        )]
        pub values: ::buffa::alloc::vec::Vec<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 UInt64In {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("UInt64In").field("values", &self.values).finish()
        }
    }
    impl UInt64In {
        /// 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.query.v1.KvPredicateConstraint.UInt64In";
    }
    unsafe impl ::buffa::DefaultInstance for UInt64In {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<UInt64In> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for UInt64In {
        /// 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.values.is_empty() {
                let payload: u32 = self
                    .values
                    .iter()
                    .map(|&v| ::buffa::types::uint64_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.values.is_empty() {
                let payload: u32 = self
                    .values
                    .iter()
                    .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
                    .sum::<u32>();
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::encoding::encode_varint(payload as u64, buf);
                for &v in &self.values {
                    ::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 {
                        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.values.reserve(len);
                        let mut limited = buf.take(len);
                        while limited.has_remaining() {
                            self.values
                                .push(::buffa::types::decode_uint64(&mut limited)?);
                        }
                        let leftover = limited.remaining();
                        if leftover > 0 {
                            limited.advance(leftover);
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        self.values.push(::buffa::types::decode_uint64(buf)?);
                    } else {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 1u32,
                            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.values.clear();
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for UInt64In {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.UInt64In";
        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 UInt64In {
        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 __U_INT64IN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.UInt64In",
        to_json: ::buffa::type_registry::any_to_json::<UInt64In>,
        from_json: ::buffa::type_registry::any_from_json::<UInt64In>,
        is_wkt: false,
    };
    /// Set membership test for uint64 values.
    #[derive(Clone, Debug, Default)]
    pub struct UInt64InView<'a> {
        /// Field 1: `values`
        pub values: ::buffa::RepeatedView<'a, u64>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> UInt64InView<'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
                        {
                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
                            let mut pcur: &[u8] = payload;
                            while !pcur.is_empty() {
                                view.values.push(::buffa::types::decode_uint64(&mut pcur)?);
                            }
                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
                        {
                            view.values.push(::buffa::types::decode_uint64(&mut cur)?);
                        } else {
                            return Err(::buffa::DecodeError::WireTypeMismatch {
                                field_number: 1u32,
                                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 UInt64InView<'a> {
        type Owned = UInt64In;
        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) -> UInt64In {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            UInt64In {
                values: self.values.to_vec(),
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for UInt64InView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<UInt64InView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for UInt64InView<'a> {
        type Static = UInt64InView<'static>;
    }
    /// Set membership test for fixed-size binary values.
    #[derive(Clone, PartialEq, Default)]
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(default)]
    pub struct FixedSizeBinaryIn {
        /// Field 1: `values`
        #[serde(
            rename = "values",
            with = "::buffa::json_helpers::proto_seq",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
        )]
        pub values: ::buffa::alloc::vec::Vec<::buffa::alloc::vec::Vec<u8>>,
        #[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 FixedSizeBinaryIn {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("FixedSizeBinaryIn").field("values", &self.values).finish()
        }
    }
    impl FixedSizeBinaryIn {
        /// 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.query.v1.KvPredicateConstraint.FixedSizeBinaryIn";
    }
    unsafe impl ::buffa::DefaultInstance for FixedSizeBinaryIn {
        fn default_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<FixedSizeBinaryIn> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    impl ::buffa::Message for FixedSizeBinaryIn {
        /// 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.values {
                size += 1u32 + ::buffa::types::bytes_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 _;
            for v in &self.values {
                ::buffa::encoding::Tag::new(
                        1u32,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )
                    .encode(buf);
                ::buffa::types::encode_bytes(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,
                        });
                    }
                    self.values.push(::buffa::types::decode_bytes(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.values.clear();
            self.__buffa_unknown_fields.clear();
            self.__buffa_cached_size.set(0);
        }
    }
    impl ::buffa::ExtensionSet for FixedSizeBinaryIn {
        const PROTO_FQN: &'static str = "store.query.v1.KvPredicateConstraint.FixedSizeBinaryIn";
        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 FixedSizeBinaryIn {
        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 __FIXED_SIZE_BINARY_IN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/store.query.v1.KvPredicateConstraint.FixedSizeBinaryIn",
        to_json: ::buffa::type_registry::any_to_json::<FixedSizeBinaryIn>,
        from_json: ::buffa::type_registry::any_from_json::<FixedSizeBinaryIn>,
        is_wkt: false,
    };
    /// Set membership test for fixed-size binary values.
    #[derive(Clone, Debug, Default)]
    pub struct FixedSizeBinaryInView<'a> {
        /// Field 1: `values`
        pub values: ::buffa::RepeatedView<'a, &'a [u8]>,
        pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
    }
    impl<'a> FixedSizeBinaryInView<'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.values.push(::buffa::types::borrow_bytes(&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 FixedSizeBinaryInView<'a> {
        type Owned = FixedSizeBinaryIn;
        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) -> FixedSizeBinaryIn {
            #[allow(unused_imports)]
            use ::buffa::alloc::string::ToString as _;
            FixedSizeBinaryIn {
                values: self.values.iter().map(|b| (b).to_vec()).collect(),
                __buffa_unknown_fields: self
                    .__buffa_unknown_fields
                    .to_owned()
                    .unwrap_or_default()
                    .into(),
                ..::core::default::Default::default()
            }
        }
    }
    unsafe impl ::buffa::DefaultViewInstance for FixedSizeBinaryInView<'static> {
        fn default_view_instance() -> &'static Self {
            static VALUE: ::buffa::__private::OnceBox<FixedSizeBinaryInView<'static>> = ::buffa::__private::OnceBox::new();
            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
        }
    }
    unsafe impl<'a> ::buffa::HasDefaultViewInstance for FixedSizeBinaryInView<'a> {
        type Static = FixedSizeBinaryInView<'static>;
    }
    #[derive(Clone, PartialEq, Debug)]
    pub enum Constraint {
        StringEq(::buffa::alloc::string::String),
        BoolEq(bool),
        FixedSizeBinaryEq(::buffa::alloc::vec::Vec<u8>),
        IntRange(::buffa::alloc::boxed::Box<super::kv_predicate_constraint::IntRange>),
        Uint64Range(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::UInt64Range>,
        ),
        FloatRange(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::FloatRange>,
        ),
        Decimal128Range(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::Decimal128Range>,
        ),
        IsNull(bool),
        IsNotNull(bool),
        StringIn(::buffa::alloc::boxed::Box<super::kv_predicate_constraint::StringIn>),
        IntIn(::buffa::alloc::boxed::Box<super::kv_predicate_constraint::IntIn>),
        Uint64In(::buffa::alloc::boxed::Box<super::kv_predicate_constraint::UInt64In>),
        FixedSizeBinaryIn(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::FixedSizeBinaryIn>,
        ),
        Decimal256Range(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::Decimal256Range>,
        ),
    }
    impl ::buffa::Oneof for Constraint {}
    impl From<super::kv_predicate_constraint::IntRange> for Constraint {
        fn from(v: super::kv_predicate_constraint::IntRange) -> Self {
            Self::IntRange(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::IntRange>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::IntRange) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::UInt64Range> for Constraint {
        fn from(v: super::kv_predicate_constraint::UInt64Range) -> Self {
            Self::Uint64Range(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::UInt64Range>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::UInt64Range) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::FloatRange> for Constraint {
        fn from(v: super::kv_predicate_constraint::FloatRange) -> Self {
            Self::FloatRange(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::FloatRange>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::FloatRange) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::Decimal128Range> for Constraint {
        fn from(v: super::kv_predicate_constraint::Decimal128Range) -> Self {
            Self::Decimal128Range(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::Decimal128Range>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::Decimal128Range) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::StringIn> for Constraint {
        fn from(v: super::kv_predicate_constraint::StringIn) -> Self {
            Self::StringIn(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::StringIn>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::StringIn) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::IntIn> for Constraint {
        fn from(v: super::kv_predicate_constraint::IntIn) -> Self {
            Self::IntIn(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::IntIn>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::IntIn) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::UInt64In> for Constraint {
        fn from(v: super::kv_predicate_constraint::UInt64In) -> Self {
            Self::Uint64In(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::UInt64In>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::UInt64In) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::FixedSizeBinaryIn> for Constraint {
        fn from(v: super::kv_predicate_constraint::FixedSizeBinaryIn) -> Self {
            Self::FixedSizeBinaryIn(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::FixedSizeBinaryIn>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::FixedSizeBinaryIn) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl From<super::kv_predicate_constraint::Decimal256Range> for Constraint {
        fn from(v: super::kv_predicate_constraint::Decimal256Range) -> Self {
            Self::Decimal256Range(::buffa::alloc::boxed::Box::new(v))
        }
    }
    impl From<super::kv_predicate_constraint::Decimal256Range>
    for ::core::option::Option<Constraint> {
        fn from(v: super::kv_predicate_constraint::Decimal256Range) -> Self {
            Self::Some(Constraint::from(v))
        }
    }
    impl serde::Serialize for Constraint {
        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 {
                Constraint::StringEq(v) => {
                    map.serialize_entry("stringEq", v)?;
                }
                Constraint::BoolEq(v) => {
                    map.serialize_entry("boolEq", v)?;
                }
                Constraint::FixedSizeBinaryEq(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("fixedSizeBinaryEq", &_W(v))?;
                }
                Constraint::IntRange(v) => {
                    map.serialize_entry("intRange", v)?;
                }
                Constraint::Uint64Range(v) => {
                    map.serialize_entry("uint64Range", v)?;
                }
                Constraint::FloatRange(v) => {
                    map.serialize_entry("floatRange", v)?;
                }
                Constraint::Decimal128Range(v) => {
                    map.serialize_entry("decimal128Range", v)?;
                }
                Constraint::IsNull(v) => {
                    map.serialize_entry("isNull", v)?;
                }
                Constraint::IsNotNull(v) => {
                    map.serialize_entry("isNotNull", v)?;
                }
                Constraint::StringIn(v) => {
                    map.serialize_entry("stringIn", v)?;
                }
                Constraint::IntIn(v) => {
                    map.serialize_entry("intIn", v)?;
                }
                Constraint::Uint64In(v) => {
                    map.serialize_entry("uint64In", v)?;
                }
                Constraint::FixedSizeBinaryIn(v) => {
                    map.serialize_entry("fixedSizeBinaryIn", v)?;
                }
                Constraint::Decimal256Range(v) => {
                    map.serialize_entry("decimal256Range", v)?;
                }
            }
            map.end()
        }
    }
    #[derive(Clone, Debug)]
    pub enum ConstraintView<'a> {
        StringEq(&'a str),
        BoolEq(bool),
        FixedSizeBinaryEq(&'a [u8]),
        IntRange(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::IntRangeView<'a>>,
        ),
        Uint64Range(
            ::buffa::alloc::boxed::Box<
                super::kv_predicate_constraint::UInt64RangeView<'a>,
            >,
        ),
        FloatRange(
            ::buffa::alloc::boxed::Box<
                super::kv_predicate_constraint::FloatRangeView<'a>,
            >,
        ),
        Decimal128Range(
            ::buffa::alloc::boxed::Box<
                super::kv_predicate_constraint::Decimal128RangeView<'a>,
            >,
        ),
        IsNull(bool),
        IsNotNull(bool),
        StringIn(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::StringInView<'a>>,
        ),
        IntIn(::buffa::alloc::boxed::Box<super::kv_predicate_constraint::IntInView<'a>>),
        Uint64In(
            ::buffa::alloc::boxed::Box<super::kv_predicate_constraint::UInt64InView<'a>>,
        ),
        FixedSizeBinaryIn(
            ::buffa::alloc::boxed::Box<
                super::kv_predicate_constraint::FixedSizeBinaryInView<'a>,
            >,
        ),
        Decimal256Range(
            ::buffa::alloc::boxed::Box<
                super::kv_predicate_constraint::Decimal256RangeView<'a>,
            >,
        ),
    }
}
/// A single predicate check: extract the field, then test it against the
/// constraint.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct KvPredicateCheck {
    /// The field to extract from each row.
    ///
    /// Field 1: `field`
    #[serde(
        rename = "field",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
    )]
    pub field: ::buffa::MessageField<KvFieldRef>,
    /// The constraint the field value must satisfy.
    ///
    /// Field 2: `constraint`
    #[serde(
        rename = "constraint",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
    )]
    pub constraint: ::buffa::MessageField<KvPredicateConstraint>,
    #[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 KvPredicateCheck {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("KvPredicateCheck")
            .field("field", &self.field)
            .field("constraint", &self.constraint)
            .finish()
    }
}
impl KvPredicateCheck {
    /// 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.query.v1.KvPredicateCheck";
}
unsafe impl ::buffa::DefaultInstance for KvPredicateCheck {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvPredicateCheck> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for KvPredicateCheck {
    /// 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.field.is_set() {
            let inner_size = self.field.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        if self.constraint.is_set() {
            let inner_size = self.constraint.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.field.is_set() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(self.field.cached_size() as u64, buf);
            self.field.write_to(buf);
        }
        if self.constraint.is_set() {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(self.constraint.cached_size() as u64, buf);
            self.constraint.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::Message::merge_length_delimited(
                    self.field.get_or_insert_default(),
                    buf,
                    depth,
                )?;
            }
            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::Message::merge_length_delimited(
                    self.constraint.get_or_insert_default(),
                    buf,
                    depth,
                )?;
            }
            _ => {
                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.field = ::buffa::MessageField::none();
        self.constraint = ::buffa::MessageField::none();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for KvPredicateCheck {
    const PROTO_FQN: &'static str = "store.query.v1.KvPredicateCheck";
    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 KvPredicateCheck {
    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 __KV_PREDICATE_CHECK_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.KvPredicateCheck",
    to_json: ::buffa::type_registry::any_to_json::<KvPredicateCheck>,
    from_json: ::buffa::type_registry::any_from_json::<KvPredicateCheck>,
    is_wkt: false,
};
/// A single predicate check: extract the field, then test it against the
/// constraint.
#[derive(Clone, Debug, Default)]
pub struct KvPredicateCheckView<'a> {
    /// The field to extract from each row.
    ///
    /// Field 1: `field`
    pub field: ::buffa::MessageFieldView<KvFieldRefView<'a>>,
    /// The constraint the field value must satisfy.
    ///
    /// Field 2: `constraint`
    pub constraint: ::buffa::MessageFieldView<KvPredicateConstraintView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> KvPredicateCheckView<'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)?;
                    match view.field.as_mut() {
                        Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                        None => {
                            view.field = ::buffa::MessageFieldView::set(
                                KvFieldRefView::_decode_depth(sub, depth - 1)?,
                            );
                        }
                    }
                }
                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)?;
                    match view.constraint.as_mut() {
                        Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                        None => {
                            view.constraint = ::buffa::MessageFieldView::set(
                                KvPredicateConstraintView::_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 KvPredicateCheckView<'a> {
    type Owned = KvPredicateCheck;
    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) -> KvPredicateCheck {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        KvPredicateCheck {
            field: match self.field.as_option() {
                Some(v) => {
                    ::buffa::MessageField::<KvFieldRef>::some(v.to_owned_message())
                }
                None => ::buffa::MessageField::none(),
            },
            constraint: match self.constraint.as_option() {
                Some(v) => {
                    ::buffa::MessageField::<
                        KvPredicateConstraint,
                    >::some(v.to_owned_message())
                }
                None => ::buffa::MessageField::none(),
            },
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for KvPredicateCheckView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvPredicateCheckView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for KvPredicateCheckView<'a> {
    type Static = KvPredicateCheckView<'static>;
}
/// Conjunction (AND) of predicate checks used to filter rows before reduction.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct KvPredicate {
    /// All checks must pass for a row to be included.
    ///
    /// Field 1: `checks`
    #[serde(
        rename = "checks",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub checks: ::buffa::alloc::vec::Vec<KvPredicateCheck>,
    /// When true, the predicate is statically unsatisfiable and the server may
    /// short-circuit evaluation (returns zero rows).
    ///
    /// Field 2: `contradiction`
    #[serde(
        rename = "contradiction",
        with = "::buffa::json_helpers::proto_bool",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
    )]
    pub contradiction: 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 KvPredicate {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("KvPredicate")
            .field("checks", &self.checks)
            .field("contradiction", &self.contradiction)
            .finish()
    }
}
impl KvPredicate {
    /// 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.query.v1.KvPredicate";
}
unsafe impl ::buffa::DefaultInstance for KvPredicate {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvPredicate> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for KvPredicate {
    /// 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.contradiction {
            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
        }
        for v in &self.checks {
            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.contradiction {
            ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_bool(self.contradiction, buf);
        }
        for v in &self.checks {
            ::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() {
            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.contradiction = ::buffa::types::decode_bool(buf)?;
            }
            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.checks.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.contradiction = false;
        self.checks.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for KvPredicate {
    const PROTO_FQN: &'static str = "store.query.v1.KvPredicate";
    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 KvPredicate {
    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 __KV_PREDICATE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.KvPredicate",
    to_json: ::buffa::type_registry::any_to_json::<KvPredicate>,
    from_json: ::buffa::type_registry::any_from_json::<KvPredicate>,
    is_wkt: false,
};
/// Conjunction (AND) of predicate checks used to filter rows before reduction.
#[derive(Clone, Debug, Default)]
pub struct KvPredicateView<'a> {
    /// All checks must pass for a row to be included.
    ///
    /// Field 1: `checks`
    pub checks: ::buffa::RepeatedView<'a, KvPredicateCheckView<'a>>,
    /// When true, the predicate is statically unsatisfiable and the server may
    /// short-circuit evaluation (returns zero rows).
    ///
    /// Field 2: `contradiction`
    pub contradiction: bool,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> KvPredicateView<'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() {
                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.contradiction = ::buffa::types::decode_bool(&mut cur)?;
                }
                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.checks
                        .push(KvPredicateCheckView::_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 KvPredicateView<'a> {
    type Owned = KvPredicate;
    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) -> KvPredicate {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        KvPredicate {
            checks: self.checks.iter().map(|v| v.to_owned_message()).collect(),
            contradiction: self.contradiction,
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for KvPredicateView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<KvPredicateView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for KvPredicateView<'a> {
    type Static = KvPredicateView<'static>;
}
/// A single aggregation to compute over the scanned range.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RangeReducerSpec {
    /// The aggregation operation.
    ///
    /// Field 1: `op`
    #[serde(
        rename = "op",
        with = "::buffa::json_helpers::proto_enum",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
    )]
    pub op: ::buffa::EnumValue<RangeReduceOp>,
    /// Expression to evaluate per row. Required for all ops except
    /// `COUNT_ALL` (where it must be absent).
    ///
    /// Field 2: `expr`
    #[serde(
        rename = "expr",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
    )]
    pub expr: ::buffa::MessageField<KvExpr>,
    #[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 RangeReducerSpec {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("RangeReducerSpec")
            .field("op", &self.op)
            .field("expr", &self.expr)
            .finish()
    }
}
impl RangeReducerSpec {
    /// 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.query.v1.RangeReducerSpec";
}
unsafe impl ::buffa::DefaultInstance for RangeReducerSpec {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeReducerSpec> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for RangeReducerSpec {
    /// 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;
        {
            let val = self.op.to_i32();
            if val != 0 {
                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
            }
        }
        if self.expr.is_set() {
            let inner_size = self.expr.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 _;
        {
            let val = self.op.to_i32();
            if val != 0 {
                ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_int32(val, buf);
            }
        }
        if self.expr.is_set() {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(self.expr.cached_size() as u64, buf);
            self.expr.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.op = ::buffa::EnumValue::from(::buffa::types::decode_int32(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::Message::merge_length_delimited(
                    self.expr.get_or_insert_default(),
                    buf,
                    depth,
                )?;
            }
            _ => {
                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.op = ::buffa::EnumValue::from(0);
        self.expr = ::buffa::MessageField::none();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for RangeReducerSpec {
    const PROTO_FQN: &'static str = "store.query.v1.RangeReducerSpec";
    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 RangeReducerSpec {
    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 __RANGE_REDUCER_SPEC_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.RangeReducerSpec",
    to_json: ::buffa::type_registry::any_to_json::<RangeReducerSpec>,
    from_json: ::buffa::type_registry::any_from_json::<RangeReducerSpec>,
    is_wkt: false,
};
/// A single aggregation to compute over the scanned range.
#[derive(Clone, Debug, Default)]
pub struct RangeReducerSpecView<'a> {
    /// The aggregation operation.
    ///
    /// Field 1: `op`
    pub op: ::buffa::EnumValue<RangeReduceOp>,
    /// Expression to evaluate per row. Required for all ops except
    /// `COUNT_ALL` (where it must be absent).
    ///
    /// Field 2: `expr`
    pub expr: ::buffa::MessageFieldView<KvExprView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RangeReducerSpecView<'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.op = ::buffa::EnumValue::from(
                        ::buffa::types::decode_int32(&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)?;
                    match view.expr.as_mut() {
                        Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                        None => {
                            view.expr = ::buffa::MessageFieldView::set(
                                KvExprView::_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 RangeReducerSpecView<'a> {
    type Owned = RangeReducerSpec;
    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) -> RangeReducerSpec {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        RangeReducerSpec {
            op: self.op,
            expr: match self.expr.as_option() {
                Some(v) => ::buffa::MessageField::<KvExpr>::some(v.to_owned_message()),
                None => ::buffa::MessageField::none(),
            },
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for RangeReducerSpecView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeReducerSpecView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RangeReducerSpecView<'a> {
    type Static = RangeReducerSpecView<'static>;
}
/// Parameters for a Reduce RPC: what to aggregate, how to group, and an
/// optional row filter.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct ReduceParams {
    /// Aggregations to compute. At least one reducer or one `group_by`
    /// expression is required.
    ///
    /// Field 1: `reducers`
    #[serde(
        rename = "reducers",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub reducers: ::buffa::alloc::vec::Vec<RangeReducerSpec>,
    /// Expressions whose values partition rows into groups. When non-empty,
    /// results are returned per-group in `ReduceResponse.groups` instead of as
    /// flat scalar results.
    ///
    /// Field 2: `group_by`
    #[serde(
        rename = "groupBy",
        alias = "group_by",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub group_by: ::buffa::alloc::vec::Vec<KvExpr>,
    /// Optional predicate to exclude rows before aggregation.
    ///
    /// Field 3: `filter`
    #[serde(
        rename = "filter",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
    )]
    pub filter: ::buffa::MessageField<KvPredicate>,
    #[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 ReduceParams {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("ReduceParams")
            .field("reducers", &self.reducers)
            .field("group_by", &self.group_by)
            .field("filter", &self.filter)
            .finish()
    }
}
impl ReduceParams {
    /// 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.query.v1.ReduceParams";
}
unsafe impl ::buffa::DefaultInstance for ReduceParams {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ReduceParams> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for ReduceParams {
    /// 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.filter.is_set() {
            let inner_size = self.filter.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        for v in &self.reducers {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        for v in &self.group_by {
            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.filter.is_set() {
            ::buffa::encoding::Tag::new(
                    3u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(self.filter.cached_size() as u64, buf);
            self.filter.write_to(buf);
        }
        for v in &self.reducers {
            ::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);
        }
        for v in &self.group_by {
            ::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() {
            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,
                    });
                }
                ::buffa::Message::merge_length_delimited(
                    self.filter.get_or_insert_default(),
                    buf,
                    depth,
                )?;
            }
            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.reducers.push(elem);
            }
            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.group_by.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.filter = ::buffa::MessageField::none();
        self.reducers.clear();
        self.group_by.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for ReduceParams {
    const PROTO_FQN: &'static str = "store.query.v1.ReduceParams";
    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 ReduceParams {
    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 __REDUCE_PARAMS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.ReduceParams",
    to_json: ::buffa::type_registry::any_to_json::<ReduceParams>,
    from_json: ::buffa::type_registry::any_from_json::<ReduceParams>,
    is_wkt: false,
};
/// Parameters for a Reduce RPC: what to aggregate, how to group, and an
/// optional row filter.
#[derive(Clone, Debug, Default)]
pub struct ReduceParamsView<'a> {
    /// Aggregations to compute. At least one reducer or one `group_by`
    /// expression is required.
    ///
    /// Field 1: `reducers`
    pub reducers: ::buffa::RepeatedView<'a, RangeReducerSpecView<'a>>,
    /// Expressions whose values partition rows into groups. When non-empty,
    /// results are returned per-group in `ReduceResponse.groups` instead of as
    /// flat scalar results.
    ///
    /// Field 2: `group_by`
    pub group_by: ::buffa::RepeatedView<'a, KvExprView<'a>>,
    /// Optional predicate to exclude rows before aggregation.
    ///
    /// Field 3: `filter`
    pub filter: ::buffa::MessageFieldView<KvPredicateView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ReduceParamsView<'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() {
                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)?;
                    match view.filter.as_mut() {
                        Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                        None => {
                            view.filter = ::buffa::MessageFieldView::set(
                                KvPredicateView::_decode_depth(sub, depth - 1)?,
                            );
                        }
                    }
                }
                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.reducers
                        .push(RangeReducerSpecView::_decode_depth(sub, depth - 1)?);
                }
                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.group_by.push(KvExprView::_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 ReduceParamsView<'a> {
    type Owned = ReduceParams;
    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) -> ReduceParams {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        ReduceParams {
            reducers: self.reducers.iter().map(|v| v.to_owned_message()).collect(),
            group_by: self.group_by.iter().map(|v| v.to_owned_message()).collect(),
            filter: match self.filter.as_option() {
                Some(v) => {
                    ::buffa::MessageField::<KvPredicate>::some(v.to_owned_message())
                }
                None => ::buffa::MessageField::none(),
            },
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for ReduceParamsView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ReduceParamsView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for ReduceParamsView<'a> {
    type Static = ReduceParamsView<'static>;
}
/// The result of a single reducer. Absent when no rows contributed (e.g. SUM
/// over zero matching rows).
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RangeReduceResult {
    /// Field 1: `value`
    #[serde(
        rename = "value",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
    )]
    pub value: ::buffa::MessageField<KvReducedValue>,
    #[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 RangeReduceResult {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("RangeReduceResult").field("value", &self.value).finish()
    }
}
impl RangeReduceResult {
    /// 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.query.v1.RangeReduceResult";
}
unsafe impl ::buffa::DefaultInstance for RangeReduceResult {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeReduceResult> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for RangeReduceResult {
    /// 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.value.is_set() {
            let inner_size = self.value.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.value.is_set() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(self.value.cached_size() as u64, buf);
            self.value.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::Message::merge_length_delimited(
                    self.value.get_or_insert_default(),
                    buf,
                    depth,
                )?;
            }
            _ => {
                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.value = ::buffa::MessageField::none();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for RangeReduceResult {
    const PROTO_FQN: &'static str = "store.query.v1.RangeReduceResult";
    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 RangeReduceResult {
    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 __RANGE_REDUCE_RESULT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.RangeReduceResult",
    to_json: ::buffa::type_registry::any_to_json::<RangeReduceResult>,
    from_json: ::buffa::type_registry::any_from_json::<RangeReduceResult>,
    is_wkt: false,
};
/// The result of a single reducer. Absent when no rows contributed (e.g. SUM
/// over zero matching rows).
#[derive(Clone, Debug, Default)]
pub struct RangeReduceResultView<'a> {
    /// Field 1: `value`
    pub value: ::buffa::MessageFieldView<KvReducedValueView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RangeReduceResultView<'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)?;
                    match view.value.as_mut() {
                        Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                        None => {
                            view.value = ::buffa::MessageFieldView::set(
                                KvReducedValueView::_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 RangeReduceResultView<'a> {
    type Owned = RangeReduceResult;
    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) -> RangeReduceResult {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        RangeReduceResult {
            value: match self.value.as_option() {
                Some(v) => {
                    ::buffa::MessageField::<KvReducedValue>::some(v.to_owned_message())
                }
                None => ::buffa::MessageField::none(),
            },
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for RangeReduceResultView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeReduceResultView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RangeReduceResultView<'a> {
    type Static = RangeReduceResultView<'static>;
}
/// Aggregation results for one distinct combination of group-by values.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RangeReduceGroup {
    /// The evaluated group-by expression values for this group, in the same
    /// order as `ReduceParams.group_by`.
    ///
    /// Field 1: `group_values`
    #[serde(
        rename = "groupValues",
        alias = "group_values",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub group_values: ::buffa::alloc::vec::Vec<KvReducedValue>,
    /// Parallel to `group_values`; false when the corresponding group value is
    /// NULL (the proto value is a default zero, but should be treated as absent).
    ///
    /// Field 2: `group_values_present`
    #[serde(
        rename = "groupValuesPresent",
        alias = "group_values_present",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub group_values_present: ::buffa::alloc::vec::Vec<bool>,
    /// Reducer results for this group, in the same order as
    /// `ReduceParams.reducers`.
    ///
    /// Field 3: `results`
    #[serde(
        rename = "results",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub results: ::buffa::alloc::vec::Vec<RangeReduceResult>,
    #[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 RangeReduceGroup {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("RangeReduceGroup")
            .field("group_values", &self.group_values)
            .field("group_values_present", &self.group_values_present)
            .field("results", &self.results)
            .finish()
    }
}
impl RangeReduceGroup {
    /// 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.query.v1.RangeReduceGroup";
}
unsafe impl ::buffa::DefaultInstance for RangeReduceGroup {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeReduceGroup> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for RangeReduceGroup {
    /// 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.group_values {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        if !self.group_values_present.is_empty() {
            let payload: u32 = self.group_values_present.len() as u32
                * ::buffa::types::BOOL_ENCODED_LEN as u32;
            size
                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
        }
        for v in &self.results {
            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.group_values {
            ::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);
        }
        if !self.group_values_present.is_empty() {
            let payload: u32 = self.group_values_present.len() as u32
                * ::buffa::types::BOOL_ENCODED_LEN as u32;
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(payload as u64, buf);
            for &v in &self.group_values_present {
                ::buffa::types::encode_bool(v, buf);
            }
        }
        for v in &self.results {
            ::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::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.group_values.push(elem);
            }
            2u32 => {
                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.group_values_present.reserve(len);
                    let mut limited = buf.take(len);
                    while limited.has_remaining() {
                        self.group_values_present
                            .push(::buffa::types::decode_bool(&mut limited)?);
                    }
                    let leftover = limited.remaining();
                    if leftover > 0 {
                        limited.advance(leftover);
                    }
                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                    self.group_values_present.push(::buffa::types::decode_bool(buf)?);
                } else {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 2u32,
                        expected: 2u8,
                        actual: tag.wire_type() as u8,
                    });
                }
            }
            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.results.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.group_values.clear();
        self.group_values_present.clear();
        self.results.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for RangeReduceGroup {
    const PROTO_FQN: &'static str = "store.query.v1.RangeReduceGroup";
    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 RangeReduceGroup {
    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 __RANGE_REDUCE_GROUP_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.RangeReduceGroup",
    to_json: ::buffa::type_registry::any_to_json::<RangeReduceGroup>,
    from_json: ::buffa::type_registry::any_from_json::<RangeReduceGroup>,
    is_wkt: false,
};
/// Aggregation results for one distinct combination of group-by values.
#[derive(Clone, Debug, Default)]
pub struct RangeReduceGroupView<'a> {
    /// The evaluated group-by expression values for this group, in the same
    /// order as `ReduceParams.group_by`.
    ///
    /// Field 1: `group_values`
    pub group_values: ::buffa::RepeatedView<'a, KvReducedValueView<'a>>,
    /// Parallel to `group_values`; false when the corresponding group value is
    /// NULL (the proto value is a default zero, but should be treated as absent).
    ///
    /// Field 2: `group_values_present`
    pub group_values_present: ::buffa::RepeatedView<'a, bool>,
    /// Reducer results for this group, in the same order as
    /// `ReduceParams.reducers`.
    ///
    /// Field 3: `results`
    pub results: ::buffa::RepeatedView<'a, RangeReduceResultView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RangeReduceGroupView<'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.group_values
                        .push(KvReducedValueView::_decode_depth(sub, depth - 1)?);
                }
                2u32 => {
                    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.group_values_present
                                .push(::buffa::types::decode_bool(&mut pcur)?);
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        view.group_values_present
                            .push(::buffa::types::decode_bool(&mut cur)?);
                    } else {
                        return Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 2u32,
                            expected: 2u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                }
                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.results
                        .push(RangeReduceResultView::_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 RangeReduceGroupView<'a> {
    type Owned = RangeReduceGroup;
    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) -> RangeReduceGroup {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        RangeReduceGroup {
            group_values: self
                .group_values
                .iter()
                .map(|v| v.to_owned_message())
                .collect(),
            group_values_present: self.group_values_present.to_vec(),
            results: self.results.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 RangeReduceGroupView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeReduceGroupView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RangeReduceGroupView<'a> {
    type Static = RangeReduceGroupView<'static>;
}
/// Point lookup request for a single key.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct GetRequest {
    /// The key to look up (max 254 bytes).
    ///
    /// Field 1: `key`
    #[serde(
        rename = "key",
        with = "::buffa::json_helpers::bytes",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
    )]
    pub key: ::buffa::alloc::vec::Vec<u8>,
    /// Optional freshness gate. See service-level comment.
    ///
    /// Field 2: `min_sequence_number`
    #[serde(
        rename = "minSequenceNumber",
        alias = "min_sequence_number",
        with = "::buffa::json_helpers::opt_uint64",
        skip_serializing_if = "Option::is_none"
    )]
    pub min_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 GetRequest {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("GetRequest")
            .field("key", &self.key)
            .field("min_sequence_number", &self.min_sequence_number)
            .finish()
    }
}
impl GetRequest {
    /// 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.query.v1.GetRequest";
}
unsafe impl ::buffa::DefaultInstance for GetRequest {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetRequest> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for GetRequest {
    /// 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.key.is_empty() {
            size += 1u32 + ::buffa::types::bytes_encoded_len(&self.key) as u32;
        }
        if let Some(v) = self.min_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.key.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(&self.key, buf);
        }
        if let Some(v) = self.min_sequence_number {
            ::buffa::encoding::Tag::new(2u32, ::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_bytes(&mut self.key, 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.min_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.key.clear();
        self.min_sequence_number = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for GetRequest {
    const PROTO_FQN: &'static str = "store.query.v1.GetRequest";
    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 GetRequest {
    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 __GET_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.GetRequest",
    to_json: ::buffa::type_registry::any_to_json::<GetRequest>,
    from_json: ::buffa::type_registry::any_from_json::<GetRequest>,
    is_wkt: false,
};
/// Point lookup request for a single key.
#[derive(Clone, Debug, Default)]
pub struct GetRequestView<'a> {
    /// The key to look up (max 254 bytes).
    ///
    /// Field 1: `key`
    pub key: &'a [u8],
    /// Optional freshness gate. See service-level comment.
    ///
    /// Field 2: `min_sequence_number`
    pub min_sequence_number: ::core::option::Option<u64>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> GetRequestView<'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.key = ::buffa::types::borrow_bytes(&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.min_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 GetRequestView<'a> {
    type Owned = GetRequest;
    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) -> GetRequest {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        GetRequest {
            key: (self.key).to_vec(),
            min_sequence_number: self.min_sequence_number,
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for GetRequestView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetRequestView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for GetRequestView<'a> {
    type Static = GetRequestView<'static>;
}
/// Point lookup response.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct GetResponse {
    /// The value associated with the key; absent when the key does not exist.
    ///
    /// Field 2: `value`
    #[serde(
        rename = "value",
        with = "::buffa::json_helpers::opt_bytes",
        skip_serializing_if = "Option::is_none"
    )]
    pub value: Option<::buffa::alloc::vec::Vec<u8>>,
    #[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 GetResponse {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("GetResponse").field("value", &self.value).finish()
    }
}
impl GetResponse {
    /// 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.query.v1.GetResponse";
}
unsafe impl ::buffa::DefaultInstance for GetResponse {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetResponse> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for GetResponse {
    /// 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 Some(ref v) = self.value {
            size += 1u32 + ::buffa::types::bytes_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 let Some(ref v) = self.value {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(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() {
            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_bytes(
                    self.value.get_or_insert_with(::buffa::alloc::vec::Vec::new),
                    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.value = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for GetResponse {
    const PROTO_FQN: &'static str = "store.query.v1.GetResponse";
    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 GetResponse {
    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 __GET_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.GetResponse",
    to_json: ::buffa::type_registry::any_to_json::<GetResponse>,
    from_json: ::buffa::type_registry::any_from_json::<GetResponse>,
    is_wkt: false,
};
/// Point lookup response.
#[derive(Clone, Debug, Default)]
pub struct GetResponseView<'a> {
    /// The value associated with the key; absent when the key does not exist.
    ///
    /// Field 2: `value`
    pub value: ::core::option::Option<&'a [u8]>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> GetResponseView<'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() {
                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.value = Some(::buffa::types::borrow_bytes(&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 GetResponseView<'a> {
    type Owned = GetResponse;
    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) -> GetResponse {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        GetResponse {
            value: self.value.map(|b| (b).to_vec()),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for GetResponseView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetResponseView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for GetResponseView<'a> {
    type Static = GetResponseView<'static>;
}
/// GetMany performs batch point lookups. Results stream back as frames, each
/// containing one or more entries. Each entry includes its key so results may
/// arrive in any order. Missing keys have `value` absent.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct GetManyRequest {
    /// Field 1: `keys`
    #[serde(
        rename = "keys",
        with = "::buffa::json_helpers::proto_seq",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
    )]
    pub keys: ::buffa::alloc::vec::Vec<::buffa::alloc::vec::Vec<u8>>,
    /// Field 2: `min_sequence_number`
    #[serde(
        rename = "minSequenceNumber",
        alias = "min_sequence_number",
        with = "::buffa::json_helpers::opt_uint64",
        skip_serializing_if = "Option::is_none"
    )]
    pub min_sequence_number: Option<u64>,
    /// Field 3: `batch_size`
    #[serde(
        rename = "batchSize",
        alias = "batch_size",
        with = "::buffa::json_helpers::uint32",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
    )]
    pub batch_size: 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 GetManyRequest {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("GetManyRequest")
            .field("keys", &self.keys)
            .field("min_sequence_number", &self.min_sequence_number)
            .field("batch_size", &self.batch_size)
            .finish()
    }
}
impl GetManyRequest {
    /// 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.query.v1.GetManyRequest";
}
unsafe impl ::buffa::DefaultInstance for GetManyRequest {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetManyRequest> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for GetManyRequest {
    /// 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 Some(v) = self.min_sequence_number {
            size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
        }
        if self.batch_size != 0u32 {
            size += 1u32 + ::buffa::types::uint32_encoded_len(self.batch_size) as u32;
        }
        for v in &self.keys {
            size += 1u32 + ::buffa::types::bytes_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 let Some(v) = self.min_sequence_number {
            ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_uint64(v, buf);
        }
        if self.batch_size != 0u32 {
            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_uint32(self.batch_size, buf);
        }
        for v in &self.keys {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(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() {
            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.min_sequence_number = ::core::option::Option::Some(
                    ::buffa::types::decode_uint64(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.batch_size = ::buffa::types::decode_uint32(buf)?;
            }
            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.keys.push(::buffa::types::decode_bytes(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.min_sequence_number = ::core::option::Option::None;
        self.batch_size = 0u32;
        self.keys.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for GetManyRequest {
    const PROTO_FQN: &'static str = "store.query.v1.GetManyRequest";
    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 GetManyRequest {
    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 __GET_MANY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.GetManyRequest",
    to_json: ::buffa::type_registry::any_to_json::<GetManyRequest>,
    from_json: ::buffa::type_registry::any_from_json::<GetManyRequest>,
    is_wkt: false,
};
/// GetMany performs batch point lookups. Results stream back as frames, each
/// containing one or more entries. Each entry includes its key so results may
/// arrive in any order. Missing keys have `value` absent.
#[derive(Clone, Debug, Default)]
pub struct GetManyRequestView<'a> {
    /// Field 1: `keys`
    pub keys: ::buffa::RepeatedView<'a, &'a [u8]>,
    /// Field 2: `min_sequence_number`
    pub min_sequence_number: ::core::option::Option<u64>,
    /// Field 3: `batch_size`
    pub batch_size: u32,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> GetManyRequestView<'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() {
                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.min_sequence_number = Some(
                        ::buffa::types::decode_uint64(&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.batch_size = ::buffa::types::decode_uint32(&mut cur)?;
                }
                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.keys.push(::buffa::types::borrow_bytes(&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 GetManyRequestView<'a> {
    type Owned = GetManyRequest;
    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) -> GetManyRequest {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        GetManyRequest {
            keys: self.keys.iter().map(|b| (b).to_vec()).collect(),
            min_sequence_number: self.min_sequence_number,
            batch_size: self.batch_size,
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for GetManyRequestView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetManyRequestView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for GetManyRequestView<'a> {
    type Static = GetManyRequestView<'static>;
}
/// A single entry in a GetMany response frame.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct GetManyEntry {
    /// The looked-up key.
    ///
    /// Field 1: `key`
    #[serde(
        rename = "key",
        with = "::buffa::json_helpers::bytes",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
    )]
    pub key: ::buffa::alloc::vec::Vec<u8>,
    /// The value if the key exists; absent for missing keys.
    ///
    /// Field 2: `value`
    #[serde(
        rename = "value",
        with = "::buffa::json_helpers::opt_bytes",
        skip_serializing_if = "Option::is_none"
    )]
    pub value: Option<::buffa::alloc::vec::Vec<u8>>,
    #[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 GetManyEntry {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("GetManyEntry")
            .field("key", &self.key)
            .field("value", &self.value)
            .finish()
    }
}
impl GetManyEntry {
    /// 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.query.v1.GetManyEntry";
}
unsafe impl ::buffa::DefaultInstance for GetManyEntry {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetManyEntry> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for GetManyEntry {
    /// 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.key.is_empty() {
            size += 1u32 + ::buffa::types::bytes_encoded_len(&self.key) as u32;
        }
        if let Some(ref v) = self.value {
            size += 1u32 + ::buffa::types::bytes_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.key.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(&self.key, buf);
        }
        if let Some(ref v) = self.value {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(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_bytes(&mut self.key, 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_bytes(
                    self.value.get_or_insert_with(::buffa::alloc::vec::Vec::new),
                    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.key.clear();
        self.value = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for GetManyEntry {
    const PROTO_FQN: &'static str = "store.query.v1.GetManyEntry";
    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 GetManyEntry {
    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 __GET_MANY_ENTRY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.GetManyEntry",
    to_json: ::buffa::type_registry::any_to_json::<GetManyEntry>,
    from_json: ::buffa::type_registry::any_from_json::<GetManyEntry>,
    is_wkt: false,
};
/// A single entry in a GetMany response frame.
#[derive(Clone, Debug, Default)]
pub struct GetManyEntryView<'a> {
    /// The looked-up key.
    ///
    /// Field 1: `key`
    pub key: &'a [u8],
    /// The value if the key exists; absent for missing keys.
    ///
    /// Field 2: `value`
    pub value: ::core::option::Option<&'a [u8]>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> GetManyEntryView<'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.key = ::buffa::types::borrow_bytes(&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.value = Some(::buffa::types::borrow_bytes(&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 GetManyEntryView<'a> {
    type Owned = GetManyEntry;
    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) -> GetManyEntry {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        GetManyEntry {
            key: (self.key).to_vec(),
            value: self.value.map(|b| (b).to_vec()),
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for GetManyEntryView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetManyEntryView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for GetManyEntryView<'a> {
    type Static = GetManyEntryView<'static>;
}
/// A batch of GetMany lookup results.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct GetManyFrame {
    /// Field 1: `results`
    #[serde(
        rename = "results",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub results: ::buffa::alloc::vec::Vec<GetManyEntry>,
    #[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 GetManyFrame {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("GetManyFrame").field("results", &self.results).finish()
    }
}
impl GetManyFrame {
    /// 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.query.v1.GetManyFrame";
}
unsafe impl ::buffa::DefaultInstance for GetManyFrame {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetManyFrame> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for GetManyFrame {
    /// 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.results {
            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.results {
            ::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.results.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.results.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for GetManyFrame {
    const PROTO_FQN: &'static str = "store.query.v1.GetManyFrame";
    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 GetManyFrame {
    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 __GET_MANY_FRAME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.GetManyFrame",
    to_json: ::buffa::type_registry::any_to_json::<GetManyFrame>,
    from_json: ::buffa::type_registry::any_from_json::<GetManyFrame>,
    is_wkt: false,
};
/// A batch of GetMany lookup results.
#[derive(Clone, Debug, Default)]
pub struct GetManyFrameView<'a> {
    /// Field 1: `results`
    pub results: ::buffa::RepeatedView<'a, GetManyEntryView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> GetManyFrameView<'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.results.push(GetManyEntryView::_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 GetManyFrameView<'a> {
    type Owned = GetManyFrame;
    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) -> GetManyFrame {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        GetManyFrame {
            results: self.results.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 GetManyFrameView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<GetManyFrameView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for GetManyFrameView<'a> {
    type Static = GetManyFrameView<'static>;
}
/// Range reads keys in lexicographic order over raw `bytes` keys.
///
/// Semantics match `StoreEngine::range_scan`: keys satisfy `start <= key <= end` when `end` is
/// non-empty (inclusive upper bound). When `end` is empty, the upper bound is unbounded (all keys
/// `>= start`). For prefix scans, pass the lexicographic maximum key of the prefix as `end`, or
/// use an empty `end` when scanning through the end of the keyspace is intended.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RangeRequest {
    /// Field 1: `start`
    #[serde(
        rename = "start",
        with = "::buffa::json_helpers::bytes",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
    )]
    pub start: ::buffa::alloc::vec::Vec<u8>,
    /// Empty means unbounded above.
    ///
    /// Field 2: `end`
    #[serde(
        rename = "end",
        with = "::buffa::json_helpers::bytes",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
    )]
    pub end: ::buffa::alloc::vec::Vec<u8>,
    /// Field 3: `limit`
    #[serde(
        rename = "limit",
        with = "::buffa::json_helpers::opt_uint32",
        skip_serializing_if = "Option::is_none"
    )]
    pub limit: Option<u32>,
    /// Field 4: `batch_size`
    #[serde(
        rename = "batchSize",
        alias = "batch_size",
        with = "::buffa::json_helpers::uint32",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
    )]
    pub batch_size: u32,
    /// Field 5: `mode`
    #[serde(
        rename = "mode",
        with = "::buffa::json_helpers::proto_enum",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
    )]
    pub mode: ::buffa::EnumValue<TraversalMode>,
    /// Field 6: `min_sequence_number`
    #[serde(
        rename = "minSequenceNumber",
        alias = "min_sequence_number",
        with = "::buffa::json_helpers::opt_uint64",
        skip_serializing_if = "Option::is_none"
    )]
    pub min_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 RangeRequest {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("RangeRequest")
            .field("start", &self.start)
            .field("end", &self.end)
            .field("limit", &self.limit)
            .field("batch_size", &self.batch_size)
            .field("mode", &self.mode)
            .field("min_sequence_number", &self.min_sequence_number)
            .finish()
    }
}
impl RangeRequest {
    /// 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.query.v1.RangeRequest";
}
unsafe impl ::buffa::DefaultInstance for RangeRequest {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeRequest> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for RangeRequest {
    /// 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.start.is_empty() {
            size += 1u32 + ::buffa::types::bytes_encoded_len(&self.start) as u32;
        }
        if !self.end.is_empty() {
            size += 1u32 + ::buffa::types::bytes_encoded_len(&self.end) as u32;
        }
        if let Some(v) = self.limit {
            size += 1u32 + ::buffa::types::uint32_encoded_len(v) as u32;
        }
        if self.batch_size != 0u32 {
            size += 1u32 + ::buffa::types::uint32_encoded_len(self.batch_size) as u32;
        }
        {
            let val = self.mode.to_i32();
            if val != 0 {
                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
            }
        }
        if let Some(v) = self.min_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.start.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(&self.start, buf);
        }
        if !self.end.is_empty() {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(&self.end, buf);
        }
        if let Some(v) = self.limit {
            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_uint32(v, buf);
        }
        if self.batch_size != 0u32 {
            ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
                .encode(buf);
            ::buffa::types::encode_uint32(self.batch_size, buf);
        }
        {
            let val = self.mode.to_i32();
            if val != 0 {
                ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
                    .encode(buf);
                ::buffa::types::encode_int32(val, buf);
            }
        }
        if let Some(v) = self.min_sequence_number {
            ::buffa::encoding::Tag::new(6u32, ::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_bytes(&mut self.start, 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_bytes(&mut self.end, 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.limit = ::core::option::Option::Some(
                    ::buffa::types::decode_uint32(buf)?,
                );
            }
            4u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 4u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.batch_size = ::buffa::types::decode_uint32(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.mode = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
            }
            6u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 6u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.min_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.start.clear();
        self.end.clear();
        self.limit = ::core::option::Option::None;
        self.batch_size = 0u32;
        self.mode = ::buffa::EnumValue::from(0);
        self.min_sequence_number = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for RangeRequest {
    const PROTO_FQN: &'static str = "store.query.v1.RangeRequest";
    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 RangeRequest {
    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 __RANGE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.RangeRequest",
    to_json: ::buffa::type_registry::any_to_json::<RangeRequest>,
    from_json: ::buffa::type_registry::any_from_json::<RangeRequest>,
    is_wkt: false,
};
/// Range reads keys in lexicographic order over raw `bytes` keys.
///
/// Semantics match `StoreEngine::range_scan`: keys satisfy `start <= key <= end` when `end` is
/// non-empty (inclusive upper bound). When `end` is empty, the upper bound is unbounded (all keys
/// `>= start`). For prefix scans, pass the lexicographic maximum key of the prefix as `end`, or
/// use an empty `end` when scanning through the end of the keyspace is intended.
#[derive(Clone, Debug, Default)]
pub struct RangeRequestView<'a> {
    /// Field 1: `start`
    pub start: &'a [u8],
    /// Empty means unbounded above.
    ///
    /// Field 2: `end`
    pub end: &'a [u8],
    /// Field 3: `limit`
    pub limit: ::core::option::Option<u32>,
    /// Field 4: `batch_size`
    pub batch_size: u32,
    /// Field 5: `mode`
    pub mode: ::buffa::EnumValue<TraversalMode>,
    /// Field 6: `min_sequence_number`
    pub min_sequence_number: ::core::option::Option<u64>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RangeRequestView<'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.start = ::buffa::types::borrow_bytes(&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.end = ::buffa::types::borrow_bytes(&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.limit = Some(::buffa::types::decode_uint32(&mut cur)?);
                }
                4u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.batch_size = ::buffa::types::decode_uint32(&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.mode = ::buffa::EnumValue::from(
                        ::buffa::types::decode_int32(&mut cur)?,
                    );
                }
                6u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 6u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.min_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 RangeRequestView<'a> {
    type Owned = RangeRequest;
    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) -> RangeRequest {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        RangeRequest {
            start: (self.start).to_vec(),
            end: (self.end).to_vec(),
            limit: self.limit,
            batch_size: self.batch_size,
            mode: self.mode,
            min_sequence_number: self.min_sequence_number,
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for RangeRequestView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeRequestView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RangeRequestView<'a> {
    type Static = RangeRequestView<'static>;
}
/// Each stream message is a batch of rows; the stream ends at HTTP END_STREAM.
/// `Detail` (sequence + read_stats) is carried only in trailers (`x-store-query-detail-bin`).
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RangeFrame {
    /// Field 1: `results`
    #[serde(
        rename = "results",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub results: ::buffa::alloc::vec::Vec<super::super::common::v1::KvEntry>,
    #[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 RangeFrame {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("RangeFrame").field("results", &self.results).finish()
    }
}
impl RangeFrame {
    /// 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.query.v1.RangeFrame";
}
unsafe impl ::buffa::DefaultInstance for RangeFrame {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeFrame> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for RangeFrame {
    /// 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.results {
            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.results {
            ::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.results.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.results.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for RangeFrame {
    const PROTO_FQN: &'static str = "store.query.v1.RangeFrame";
    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 RangeFrame {
    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 __RANGE_FRAME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.RangeFrame",
    to_json: ::buffa::type_registry::any_to_json::<RangeFrame>,
    from_json: ::buffa::type_registry::any_from_json::<RangeFrame>,
    is_wkt: false,
};
/// Each stream message is a batch of rows; the stream ends at HTTP END_STREAM.
/// `Detail` (sequence + read_stats) is carried only in trailers (`x-store-query-detail-bin`).
#[derive(Clone, Debug, Default)]
pub struct RangeFrameView<'a> {
    /// Field 1: `results`
    pub results: ::buffa::RepeatedView<'a, super::super::common::v1::KvEntryView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RangeFrameView<'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.results
                        .push(
                            super::super::common::v1::KvEntryView::_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 RangeFrameView<'a> {
    type Owned = RangeFrame;
    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) -> RangeFrame {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        RangeFrame {
            results: self.results.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 RangeFrameView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<RangeFrameView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RangeFrameView<'a> {
    type Static = RangeFrameView<'static>;
}
/// Same key-range semantics as `RangeRequest`: inclusive `[start, end]` over raw bytes when `end` is
/// non-empty; empty `end` means unbounded above.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct ReduceRequest {
    /// Field 1: `start`
    #[serde(
        rename = "start",
        with = "::buffa::json_helpers::bytes",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
    )]
    pub start: ::buffa::alloc::vec::Vec<u8>,
    /// Empty means unbounded above.
    ///
    /// Field 2: `end`
    #[serde(
        rename = "end",
        with = "::buffa::json_helpers::bytes",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_bytes"
    )]
    pub end: ::buffa::alloc::vec::Vec<u8>,
    /// Field 3: `params`
    #[serde(
        rename = "params",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
    )]
    pub params: ::buffa::MessageField<ReduceParams>,
    /// Field 4: `min_sequence_number`
    #[serde(
        rename = "minSequenceNumber",
        alias = "min_sequence_number",
        with = "::buffa::json_helpers::opt_uint64",
        skip_serializing_if = "Option::is_none"
    )]
    pub min_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 ReduceRequest {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("ReduceRequest")
            .field("start", &self.start)
            .field("end", &self.end)
            .field("params", &self.params)
            .field("min_sequence_number", &self.min_sequence_number)
            .finish()
    }
}
impl ReduceRequest {
    /// 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.query.v1.ReduceRequest";
}
unsafe impl ::buffa::DefaultInstance for ReduceRequest {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ReduceRequest> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for ReduceRequest {
    /// 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.start.is_empty() {
            size += 1u32 + ::buffa::types::bytes_encoded_len(&self.start) as u32;
        }
        if !self.end.is_empty() {
            size += 1u32 + ::buffa::types::bytes_encoded_len(&self.end) as u32;
        }
        if self.params.is_set() {
            let inner_size = self.params.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        if let Some(v) = self.min_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.start.is_empty() {
            ::buffa::encoding::Tag::new(
                    1u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(&self.start, buf);
        }
        if !self.end.is_empty() {
            ::buffa::encoding::Tag::new(
                    2u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::types::encode_bytes(&self.end, buf);
        }
        if self.params.is_set() {
            ::buffa::encoding::Tag::new(
                    3u32,
                    ::buffa::encoding::WireType::LengthDelimited,
                )
                .encode(buf);
            ::buffa::encoding::encode_varint(self.params.cached_size() as u64, buf);
            self.params.write_to(buf);
        }
        if let Some(v) = self.min_sequence_number {
            ::buffa::encoding::Tag::new(4u32, ::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_bytes(&mut self.start, 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_bytes(&mut self.end, 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,
                    });
                }
                ::buffa::Message::merge_length_delimited(
                    self.params.get_or_insert_default(),
                    buf,
                    depth,
                )?;
            }
            4u32 => {
                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                        field_number: 4u32,
                        expected: 0u8,
                        actual: tag.wire_type() as u8,
                    });
                }
                self.min_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.start.clear();
        self.end.clear();
        self.params = ::buffa::MessageField::none();
        self.min_sequence_number = ::core::option::Option::None;
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for ReduceRequest {
    const PROTO_FQN: &'static str = "store.query.v1.ReduceRequest";
    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 ReduceRequest {
    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 __REDUCE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.ReduceRequest",
    to_json: ::buffa::type_registry::any_to_json::<ReduceRequest>,
    from_json: ::buffa::type_registry::any_from_json::<ReduceRequest>,
    is_wkt: false,
};
/// Same key-range semantics as `RangeRequest`: inclusive `[start, end]` over raw bytes when `end` is
/// non-empty; empty `end` means unbounded above.
#[derive(Clone, Debug, Default)]
pub struct ReduceRequestView<'a> {
    /// Field 1: `start`
    pub start: &'a [u8],
    /// Empty means unbounded above.
    ///
    /// Field 2: `end`
    pub end: &'a [u8],
    /// Field 3: `params`
    pub params: ::buffa::MessageFieldView<ReduceParamsView<'a>>,
    /// Field 4: `min_sequence_number`
    pub min_sequence_number: ::core::option::Option<u64>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ReduceRequestView<'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.start = ::buffa::types::borrow_bytes(&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.end = ::buffa::types::borrow_bytes(&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)?;
                    match view.params.as_mut() {
                        Some(existing) => existing._merge_into_view(sub, depth - 1)?,
                        None => {
                            view.params = ::buffa::MessageFieldView::set(
                                ReduceParamsView::_decode_depth(sub, depth - 1)?,
                            );
                        }
                    }
                }
                4u32 => {
                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
                            field_number: 4u32,
                            expected: 0u8,
                            actual: tag.wire_type() as u8,
                        });
                    }
                    view.min_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 ReduceRequestView<'a> {
    type Owned = ReduceRequest;
    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) -> ReduceRequest {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        ReduceRequest {
            start: (self.start).to_vec(),
            end: (self.end).to_vec(),
            params: match self.params.as_option() {
                Some(v) => {
                    ::buffa::MessageField::<ReduceParams>::some(v.to_owned_message())
                }
                None => ::buffa::MessageField::none(),
            },
            min_sequence_number: self.min_sequence_number,
            __buffa_unknown_fields: self
                .__buffa_unknown_fields
                .to_owned()
                .unwrap_or_default()
                .into(),
            ..::core::default::Default::default()
        }
    }
}
unsafe impl ::buffa::DefaultViewInstance for ReduceRequestView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ReduceRequestView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for ReduceRequestView<'a> {
    type Static = ReduceRequestView<'static>;
}
/// Response from a Reduce RPC. Exactly one of `results` or `groups` is
/// populated depending on whether `ReduceParams.group_by` was empty.
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct ReduceResponse {
    /// Scalar reducer results (one per `ReduceParams.reducers` entry). Populated
    /// only when `group_by` is empty.
    ///
    /// Field 1: `results`
    #[serde(
        rename = "results",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub results: ::buffa::alloc::vec::Vec<RangeReduceResult>,
    /// Per-group reducer results. Populated only when `group_by` is non-empty.
    ///
    /// Field 2: `groups`
    #[serde(
        rename = "groups",
        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
        deserialize_with = "::buffa::json_helpers::null_as_default"
    )]
    pub groups: ::buffa::alloc::vec::Vec<RangeReduceGroup>,
    #[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 ReduceResponse {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("ReduceResponse")
            .field("results", &self.results)
            .field("groups", &self.groups)
            .finish()
    }
}
impl ReduceResponse {
    /// 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.query.v1.ReduceResponse";
}
unsafe impl ::buffa::DefaultInstance for ReduceResponse {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ReduceResponse> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
impl ::buffa::Message for ReduceResponse {
    /// 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.results {
            let inner_size = v.compute_size();
            size
                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
                    + inner_size;
        }
        for v in &self.groups {
            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.results {
            ::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);
        }
        for v in &self.groups {
            ::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,
                    });
                }
                let mut elem = ::core::default::Default::default();
                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
                self.results.push(elem);
            }
            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.groups.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.results.clear();
        self.groups.clear();
        self.__buffa_unknown_fields.clear();
        self.__buffa_cached_size.set(0);
    }
}
impl ::buffa::ExtensionSet for ReduceResponse {
    const PROTO_FQN: &'static str = "store.query.v1.ReduceResponse";
    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 ReduceResponse {
    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 __REDUCE_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/store.query.v1.ReduceResponse",
    to_json: ::buffa::type_registry::any_to_json::<ReduceResponse>,
    from_json: ::buffa::type_registry::any_from_json::<ReduceResponse>,
    is_wkt: false,
};
/// Response from a Reduce RPC. Exactly one of `results` or `groups` is
/// populated depending on whether `ReduceParams.group_by` was empty.
#[derive(Clone, Debug, Default)]
pub struct ReduceResponseView<'a> {
    /// Scalar reducer results (one per `ReduceParams.reducers` entry). Populated
    /// only when `group_by` is empty.
    ///
    /// Field 1: `results`
    pub results: ::buffa::RepeatedView<'a, RangeReduceResultView<'a>>,
    /// Per-group reducer results. Populated only when `group_by` is non-empty.
    ///
    /// Field 2: `groups`
    pub groups: ::buffa::RepeatedView<'a, RangeReduceGroupView<'a>>,
    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ReduceResponseView<'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.results
                        .push(RangeReduceResultView::_decode_depth(sub, depth - 1)?);
                }
                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.groups
                        .push(RangeReduceGroupView::_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 ReduceResponseView<'a> {
    type Owned = ReduceResponse;
    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) -> ReduceResponse {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        ReduceResponse {
            results: self.results.iter().map(|v| v.to_owned_message()).collect(),
            groups: self.groups.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 ReduceResponseView<'static> {
    fn default_view_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<ReduceResponseView<'static>> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for ReduceResponseView<'a> {
    type Static = ReduceResponseView<'static>;
}

/// Full service name for this service.
pub const SERVICE_SERVICE_NAME: &str = "store.query.v1.Service";
/// Server trait for Service.
///
/// # 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 {
    /// Point lookup of a single key.
    fn get(
        &self,
        ctx: ::connectrpc::Context,
        request: ::buffa::view::OwnedView<GetRequestView<'static>>,
    ) -> impl ::std::future::Future<
        Output = Result<(GetResponse, ::connectrpc::Context), ::connectrpc::ConnectError>,
    > + Send;
    /// Batch point lookup of multiple keys, streamed back in frames.
    fn get_many(
        &self,
        ctx: ::connectrpc::Context,
        request: ::buffa::view::OwnedView<GetManyRequestView<'static>>,
    ) -> impl ::std::future::Future<
        Output = Result<
            (
                ::std::pin::Pin<
                    Box<
                        dyn ::futures::Stream<
                            Item = Result<GetManyFrame, ::connectrpc::ConnectError>,
                        > + Send,
                    >,
                >,
                ::connectrpc::Context,
            ),
            ::connectrpc::ConnectError,
        >,
    > + Send;
    /// Lexicographic range scan, streamed back in batched frames.
    fn range(
        &self,
        ctx: ::connectrpc::Context,
        request: ::buffa::view::OwnedView<RangeRequestView<'static>>,
    ) -> impl ::std::future::Future<
        Output = Result<
            (
                ::std::pin::Pin<
                    Box<
                        dyn ::futures::Stream<
                            Item = Result<RangeFrame, ::connectrpc::ConnectError>,
                        > + Send,
                    >,
                >,
                ::connectrpc::Context,
            ),
            ::connectrpc::ConnectError,
        >,
    > + Send;
    /// Server-side aggregation over a key range with optional grouping and
    /// filtering.
    fn reduce(
        &self,
        ctx: ::connectrpc::Context,
        request: ::buffa::view::OwnedView<ReduceRequestView<'static>>,
    ) -> impl ::std::future::Future<
        Output = Result<
            (ReduceResponse, ::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_idempotent(
                SERVICE_SERVICE_NAME,
                "Get",
                {
                    let svc = ::std::sync::Arc::clone(&self);
                    ::connectrpc::view_handler_fn(move |ctx, req| {
                        let svc = ::std::sync::Arc::clone(&svc);
                        async move { svc.get(ctx, req).await }
                    })
                },
            )
            .route_view_server_stream(
                SERVICE_SERVICE_NAME,
                "GetMany",
                ::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.get_many(ctx, req).await }
                    }
                }),
            )
            .route_view_server_stream(
                SERVICE_SERVICE_NAME,
                "Range",
                ::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.range(ctx, req).await }
                    }
                }),
            )
            .route_view_idempotent(
                SERVICE_SERVICE_NAME,
                "Reduce",
                {
                    let svc = ::std::sync::Arc::clone(&self);
                    ::connectrpc::view_handler_fn(move |ctx, req| {
                        let svc = ::std::sync::Arc::clone(&svc);
                        async move { svc.reduce(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.query.v1.Service/")?;
        match method {
            "Get" => {
                Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(true))
            }
            "GetMany" => {
                Some(
                    ::connectrpc::dispatcher::codegen::MethodDescriptor::server_streaming(),
                )
            }
            "Range" => {
                Some(
                    ::connectrpc::dispatcher::codegen::MethodDescriptor::server_streaming(),
                )
            }
            "Reduce" => {
                Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(true))
            }
            _ => 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.query.v1.Service/") else {
            return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
        };
        let _ = (&ctx, &request, &format);
        match method {
            "Get" => {
                let svc = ::std::sync::Arc::clone(&self.inner);
                Box::pin(async move {
                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
                        GetRequestView,
                    >(request, format)?;
                    let (res, ctx) = svc.get(ctx, req).await?;
                    let bytes = ::connectrpc::dispatcher::codegen::encode_response(
                        &res,
                        format,
                    )?;
                    Ok((bytes, ctx))
                })
            }
            "Reduce" => {
                let svc = ::std::sync::Arc::clone(&self.inner);
                Box::pin(async move {
                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
                        ReduceRequestView,
                    >(request, format)?;
                    let (res, ctx) = svc.reduce(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.query.v1.Service/") else {
            return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
        };
        let _ = (&ctx, &request, &format);
        match method {
            "GetMany" => {
                let svc = ::std::sync::Arc::clone(&self.inner);
                Box::pin(async move {
                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
                        GetManyRequestView,
                    >(request, format)?;
                    let (resp_stream, ctx) = svc.get_many(ctx, req).await?;
                    Ok((
                        ::connectrpc::dispatcher::codegen::encode_response_stream(
                            resp_stream,
                            format,
                        ),
                        ctx,
                    ))
                })
            }
            "Range" => {
                let svc = ::std::sync::Arc::clone(&self.inner);
                Box::pin(async move {
                    let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
                        RangeRequestView,
                    >(request, format)?;
                    let (resp_stream, ctx) = svc.range(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.query.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.query.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.get(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.get(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.get(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.get(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 Get RPC. Sends a request to /store.query.v1.Service/Get.
    pub async fn get(
        &self,
        request: GetRequest,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<GetResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        self.get_with_options(request, ::connectrpc::client::CallOptions::default())
            .await
    }
    /// Call the Get RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
    pub async fn get_with_options(
        &self,
        request: GetRequest,
        options: ::connectrpc::client::CallOptions,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<GetResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        ::connectrpc::client::call_unary(
                &self.transport,
                &self.config,
                SERVICE_SERVICE_NAME,
                "Get",
                request,
                options,
            )
            .await
    }
    /// Call the GetMany RPC. Sends a request to /store.query.v1.Service/GetMany.
    pub async fn get_many(
        &self,
        request: GetManyRequest,
    ) -> Result<
        ::connectrpc::client::ServerStream<T::ResponseBody, GetManyFrameView<'static>>,
        ::connectrpc::ConnectError,
    > {
        self.get_many_with_options(request, ::connectrpc::client::CallOptions::default())
            .await
    }
    /// Call the GetMany RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
    pub async fn get_many_with_options(
        &self,
        request: GetManyRequest,
        options: ::connectrpc::client::CallOptions,
    ) -> Result<
        ::connectrpc::client::ServerStream<T::ResponseBody, GetManyFrameView<'static>>,
        ::connectrpc::ConnectError,
    > {
        ::connectrpc::client::call_server_stream(
                &self.transport,
                &self.config,
                SERVICE_SERVICE_NAME,
                "GetMany",
                request,
                options,
            )
            .await
    }
    /// Call the Range RPC. Sends a request to /store.query.v1.Service/Range.
    pub async fn range(
        &self,
        request: RangeRequest,
    ) -> Result<
        ::connectrpc::client::ServerStream<T::ResponseBody, RangeFrameView<'static>>,
        ::connectrpc::ConnectError,
    > {
        self.range_with_options(request, ::connectrpc::client::CallOptions::default())
            .await
    }
    /// Call the Range RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
    pub async fn range_with_options(
        &self,
        request: RangeRequest,
        options: ::connectrpc::client::CallOptions,
    ) -> Result<
        ::connectrpc::client::ServerStream<T::ResponseBody, RangeFrameView<'static>>,
        ::connectrpc::ConnectError,
    > {
        ::connectrpc::client::call_server_stream(
                &self.transport,
                &self.config,
                SERVICE_SERVICE_NAME,
                "Range",
                request,
                options,
            )
            .await
    }
    /// Call the Reduce RPC. Sends a request to /store.query.v1.Service/Reduce.
    pub async fn reduce(
        &self,
        request: ReduceRequest,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<ReduceResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        self.reduce_with_options(request, ::connectrpc::client::CallOptions::default())
            .await
    }
    /// Call the Reduce RPC with explicit per-call options. Options override [`connectrpc::client::ClientConfig`] defaults.
    pub async fn reduce_with_options(
        &self,
        request: ReduceRequest,
        options: ::connectrpc::client::CallOptions,
    ) -> Result<
        ::connectrpc::client::UnaryResponse<
            ::buffa::view::OwnedView<ReduceResponseView<'static>>,
        >,
        ::connectrpc::ConnectError,
    > {
        ::connectrpc::client::call_unary(
                &self.transport,
                &self.config,
                SERVICE_SERVICE_NAME,
                "Reduce",
                request,
                options,
            )
            .await
    }
}
