#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ChangeStreamRecord {
pub record: std::option::Option<crate::model::change_stream_record::Record>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ChangeStreamRecord {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_record<
T: std::convert::Into<std::option::Option<crate::model::change_stream_record::Record>>,
>(
mut self,
v: T,
) -> Self {
self.record = v.into();
self
}
pub fn data_change_record(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::change_stream_record::DataChangeRecord>>
{
#[allow(unreachable_patterns)]
self.record.as_ref().and_then(|v| match v {
crate::model::change_stream_record::Record::DataChangeRecord(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_data_change_record<
T: std::convert::Into<std::boxed::Box<crate::model::change_stream_record::DataChangeRecord>>,
>(
mut self,
v: T,
) -> Self {
self.record = std::option::Option::Some(
crate::model::change_stream_record::Record::DataChangeRecord(v.into()),
);
self
}
pub fn heartbeat_record(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::change_stream_record::HeartbeatRecord>>
{
#[allow(unreachable_patterns)]
self.record.as_ref().and_then(|v| match v {
crate::model::change_stream_record::Record::HeartbeatRecord(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_heartbeat_record<
T: std::convert::Into<std::boxed::Box<crate::model::change_stream_record::HeartbeatRecord>>,
>(
mut self,
v: T,
) -> Self {
self.record = std::option::Option::Some(
crate::model::change_stream_record::Record::HeartbeatRecord(v.into()),
);
self
}
pub fn partition_start_record(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::change_stream_record::PartitionStartRecord>,
> {
#[allow(unreachable_patterns)]
self.record.as_ref().and_then(|v| match v {
crate::model::change_stream_record::Record::PartitionStartRecord(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_partition_start_record<
T: std::convert::Into<
std::boxed::Box<crate::model::change_stream_record::PartitionStartRecord>,
>,
>(
mut self,
v: T,
) -> Self {
self.record = std::option::Option::Some(
crate::model::change_stream_record::Record::PartitionStartRecord(v.into()),
);
self
}
pub fn partition_end_record(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::change_stream_record::PartitionEndRecord>>
{
#[allow(unreachable_patterns)]
self.record.as_ref().and_then(|v| match v {
crate::model::change_stream_record::Record::PartitionEndRecord(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_partition_end_record<
T: std::convert::Into<std::boxed::Box<crate::model::change_stream_record::PartitionEndRecord>>,
>(
mut self,
v: T,
) -> Self {
self.record = std::option::Option::Some(
crate::model::change_stream_record::Record::PartitionEndRecord(v.into()),
);
self
}
pub fn partition_event_record(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::change_stream_record::PartitionEventRecord>,
> {
#[allow(unreachable_patterns)]
self.record.as_ref().and_then(|v| match v {
crate::model::change_stream_record::Record::PartitionEventRecord(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_partition_event_record<
T: std::convert::Into<
std::boxed::Box<crate::model::change_stream_record::PartitionEventRecord>,
>,
>(
mut self,
v: T,
) -> Self {
self.record = std::option::Option::Some(
crate::model::change_stream_record::Record::PartitionEventRecord(v.into()),
);
self
}
}
impl wkt::message::Message for ChangeStreamRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord"
}
}
pub mod change_stream_record {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataChangeRecord {
pub commit_timestamp: std::option::Option<wkt::Timestamp>,
pub record_sequence: std::string::String,
pub server_transaction_id: std::string::String,
pub is_last_record_in_transaction_in_partition: bool,
pub table: std::string::String,
pub column_metadata:
std::vec::Vec<crate::model::change_stream_record::data_change_record::ColumnMetadata>,
pub mods: std::vec::Vec<crate::model::change_stream_record::data_change_record::Mod>,
pub mod_type: crate::model::change_stream_record::data_change_record::ModType,
pub value_capture_type:
crate::model::change_stream_record::data_change_record::ValueCaptureType,
pub number_of_records_in_transaction: i32,
pub number_of_partitions_in_transaction: i32,
pub transaction_tag: std::string::String,
pub is_system_transaction: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataChangeRecord {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_commit_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_commit_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = v.map(|x| x.into());
self
}
pub fn set_record_sequence<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.record_sequence = v.into();
self
}
pub fn set_server_transaction_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.server_transaction_id = v.into();
self
}
pub fn set_is_last_record_in_transaction_in_partition<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.is_last_record_in_transaction_in_partition = v.into();
self
}
pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table = v.into();
self
}
pub fn set_column_metadata<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::change_stream_record::data_change_record::ColumnMetadata,
>,
{
use std::iter::Iterator;
self.column_metadata = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_mods<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::change_stream_record::data_change_record::Mod>,
{
use std::iter::Iterator;
self.mods = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_mod_type<
T: std::convert::Into<crate::model::change_stream_record::data_change_record::ModType>,
>(
mut self,
v: T,
) -> Self {
self.mod_type = v.into();
self
}
pub fn set_value_capture_type<
T: std::convert::Into<
crate::model::change_stream_record::data_change_record::ValueCaptureType,
>,
>(
mut self,
v: T,
) -> Self {
self.value_capture_type = v.into();
self
}
pub fn set_number_of_records_in_transaction<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.number_of_records_in_transaction = v.into();
self
}
pub fn set_number_of_partitions_in_transaction<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.number_of_partitions_in_transaction = v.into();
self
}
pub fn set_transaction_tag<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.transaction_tag = v.into();
self
}
pub fn set_is_system_transaction<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_system_transaction = v.into();
self
}
}
impl wkt::message::Message for DataChangeRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.DataChangeRecord"
}
}
pub mod data_change_record {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ColumnMetadata {
pub name: std::string::String,
pub r#type: std::option::Option<crate::model::Type>,
pub is_primary_key: bool,
pub ordinal_position: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ColumnMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.r#type = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.r#type = v.map(|x| x.into());
self
}
pub fn set_is_primary_key<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_primary_key = v.into();
self
}
pub fn set_ordinal_position<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.ordinal_position = v.into();
self
}
}
impl wkt::message::Message for ColumnMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ColumnMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModValue {
pub column_metadata_index: i32,
pub value: std::option::Option<wkt::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModValue {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_column_metadata_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.column_metadata_index = v.into();
self
}
pub fn set_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ModValue {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ModValue"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Mod {
pub keys:
std::vec::Vec<crate::model::change_stream_record::data_change_record::ModValue>,
pub old_values:
std::vec::Vec<crate::model::change_stream_record::data_change_record::ModValue>,
pub new_values:
std::vec::Vec<crate::model::change_stream_record::data_change_record::ModValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Mod {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_keys<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::change_stream_record::data_change_record::ModValue,
>,
{
use std::iter::Iterator;
self.keys = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_old_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::change_stream_record::data_change_record::ModValue,
>,
{
use std::iter::Iterator;
self.old_values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_new_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::change_stream_record::data_change_record::ModValue,
>,
{
use std::iter::Iterator;
self.new_values = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Mod {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.DataChangeRecord.Mod"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ModType {
Unspecified,
Insert,
Update,
Delete,
UnknownValue(mod_type::UnknownValue),
}
#[doc(hidden)]
pub mod mod_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ModType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Insert => std::option::Option::Some(10),
Self::Update => std::option::Option::Some(20),
Self::Delete => std::option::Option::Some(30),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MOD_TYPE_UNSPECIFIED"),
Self::Insert => std::option::Option::Some("INSERT"),
Self::Update => std::option::Option::Some("UPDATE"),
Self::Delete => std::option::Option::Some("DELETE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ModType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ModType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ModType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
10 => Self::Insert,
20 => Self::Update,
30 => Self::Delete,
_ => Self::UnknownValue(mod_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ModType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MOD_TYPE_UNSPECIFIED" => Self::Unspecified,
"INSERT" => Self::Insert,
"UPDATE" => Self::Update,
"DELETE" => Self::Delete,
_ => Self::UnknownValue(mod_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ModType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Insert => serializer.serialize_i32(10),
Self::Update => serializer.serialize_i32(20),
Self::Delete => serializer.serialize_i32(30),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ModType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModType>::new(
".google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ModType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ValueCaptureType {
Unspecified,
OldAndNewValues,
NewValues,
NewRow,
NewRowAndOldValues,
UnknownValue(value_capture_type::UnknownValue),
}
#[doc(hidden)]
pub mod value_capture_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ValueCaptureType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::OldAndNewValues => std::option::Option::Some(10),
Self::NewValues => std::option::Option::Some(20),
Self::NewRow => std::option::Option::Some(30),
Self::NewRowAndOldValues => std::option::Option::Some(40),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("VALUE_CAPTURE_TYPE_UNSPECIFIED")
}
Self::OldAndNewValues => std::option::Option::Some("OLD_AND_NEW_VALUES"),
Self::NewValues => std::option::Option::Some("NEW_VALUES"),
Self::NewRow => std::option::Option::Some("NEW_ROW"),
Self::NewRowAndOldValues => std::option::Option::Some("NEW_ROW_AND_OLD_VALUES"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ValueCaptureType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ValueCaptureType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ValueCaptureType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
10 => Self::OldAndNewValues,
20 => Self::NewValues,
30 => Self::NewRow,
40 => Self::NewRowAndOldValues,
_ => Self::UnknownValue(value_capture_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ValueCaptureType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"VALUE_CAPTURE_TYPE_UNSPECIFIED" => Self::Unspecified,
"OLD_AND_NEW_VALUES" => Self::OldAndNewValues,
"NEW_VALUES" => Self::NewValues,
"NEW_ROW" => Self::NewRow,
"NEW_ROW_AND_OLD_VALUES" => Self::NewRowAndOldValues,
_ => Self::UnknownValue(value_capture_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ValueCaptureType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::OldAndNewValues => serializer.serialize_i32(10),
Self::NewValues => serializer.serialize_i32(20),
Self::NewRow => serializer.serialize_i32(30),
Self::NewRowAndOldValues => serializer.serialize_i32(40),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ValueCaptureType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueCaptureType>::new(
".google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ValueCaptureType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HeartbeatRecord {
pub timestamp: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HeartbeatRecord {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.timestamp = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for HeartbeatRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.HeartbeatRecord"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionStartRecord {
pub start_timestamp: std::option::Option<wkt::Timestamp>,
pub record_sequence: std::string::String,
pub partition_tokens: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionStartRecord {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_timestamp = v.map(|x| x.into());
self
}
pub fn set_record_sequence<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.record_sequence = v.into();
self
}
pub fn set_partition_tokens<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.partition_tokens = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PartitionStartRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.PartitionStartRecord"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionEndRecord {
pub end_timestamp: std::option::Option<wkt::Timestamp>,
pub record_sequence: std::string::String,
pub partition_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionEndRecord {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_end_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_timestamp = v.map(|x| x.into());
self
}
pub fn set_record_sequence<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.record_sequence = v.into();
self
}
pub fn set_partition_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.partition_token = v.into();
self
}
}
impl wkt::message::Message for PartitionEndRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.PartitionEndRecord"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionEventRecord {
pub commit_timestamp: std::option::Option<wkt::Timestamp>,
pub record_sequence: std::string::String,
pub partition_token: std::string::String,
pub move_in_events:
std::vec::Vec<crate::model::change_stream_record::partition_event_record::MoveInEvent>,
pub move_out_events:
std::vec::Vec<crate::model::change_stream_record::partition_event_record::MoveOutEvent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionEventRecord {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_commit_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_commit_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = v.map(|x| x.into());
self
}
pub fn set_record_sequence<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.record_sequence = v.into();
self
}
pub fn set_partition_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.partition_token = v.into();
self
}
pub fn set_move_in_events<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::change_stream_record::partition_event_record::MoveInEvent,
>,
{
use std::iter::Iterator;
self.move_in_events = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_move_out_events<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::change_stream_record::partition_event_record::MoveOutEvent,
>,
{
use std::iter::Iterator;
self.move_out_events = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PartitionEventRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.PartitionEventRecord"
}
}
pub mod partition_event_record {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MoveInEvent {
pub source_partition_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MoveInEvent {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_source_partition_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.source_partition_token = v.into();
self
}
}
impl wkt::message::Message for MoveInEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.MoveInEvent"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MoveOutEvent {
pub destination_partition_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MoveOutEvent {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_destination_partition_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.destination_partition_token = v.into();
self
}
}
impl wkt::message::Message for MoveOutEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.MoveOutEvent"
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Record {
DataChangeRecord(std::boxed::Box<crate::model::change_stream_record::DataChangeRecord>),
HeartbeatRecord(std::boxed::Box<crate::model::change_stream_record::HeartbeatRecord>),
PartitionStartRecord(
std::boxed::Box<crate::model::change_stream_record::PartitionStartRecord>,
),
PartitionEndRecord(std::boxed::Box<crate::model::change_stream_record::PartitionEndRecord>),
PartitionEventRecord(
std::boxed::Box<crate::model::change_stream_record::PartitionEventRecord>,
),
}
impl Record {
pub fn from_data_change_record(
value: impl std::convert::Into<
std::boxed::Box<crate::model::change_stream_record::DataChangeRecord>,
>,
) -> Self {
Self::DataChangeRecord(value.into())
}
pub fn from_heartbeat_record(
value: impl std::convert::Into<
std::boxed::Box<crate::model::change_stream_record::HeartbeatRecord>,
>,
) -> Self {
Self::HeartbeatRecord(value.into())
}
pub fn from_partition_start_record(
value: impl std::convert::Into<
std::boxed::Box<crate::model::change_stream_record::PartitionStartRecord>,
>,
) -> Self {
Self::PartitionStartRecord(value.into())
}
pub fn from_partition_end_record(
value: impl std::convert::Into<
std::boxed::Box<crate::model::change_stream_record::PartitionEndRecord>,
>,
) -> Self {
Self::PartitionEndRecord(value.into())
}
pub fn from_partition_event_record(
value: impl std::convert::Into<
std::boxed::Box<crate::model::change_stream_record::PartitionEventRecord>,
>,
) -> Self {
Self::PartitionEventRecord(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CommitResponse {
pub commit_timestamp: std::option::Option<wkt::Timestamp>,
pub commit_stats: std::option::Option<crate::model::commit_response::CommitStats>,
pub snapshot_timestamp: std::option::Option<wkt::Timestamp>,
pub cache_update: std::option::Option<crate::model::CacheUpdate>,
pub isolation_level: crate::model::transaction_options::IsolationLevel,
pub read_lock_mode: crate::model::transaction_options::read_write::ReadLockMode,
pub multiplexed_session_retry:
std::option::Option<crate::model::commit_response::MultiplexedSessionRetry>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CommitResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_commit_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_commit_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = v.map(|x| x.into());
self
}
pub fn set_commit_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::commit_response::CommitStats>,
{
self.commit_stats = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_commit_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::commit_response::CommitStats>,
{
self.commit_stats = v.map(|x| x.into());
self
}
pub fn set_snapshot_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.snapshot_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_snapshot_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.snapshot_timestamp = v.map(|x| x.into());
self
}
pub fn set_cache_update<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cache_update<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = v.map(|x| x.into());
self
}
pub fn set_isolation_level<
T: std::convert::Into<crate::model::transaction_options::IsolationLevel>,
>(
mut self,
v: T,
) -> Self {
self.isolation_level = v.into();
self
}
pub fn set_read_lock_mode<
T: std::convert::Into<crate::model::transaction_options::read_write::ReadLockMode>,
>(
mut self,
v: T,
) -> Self {
self.read_lock_mode = v.into();
self
}
pub fn set_multiplexed_session_retry<
T: std::convert::Into<
std::option::Option<crate::model::commit_response::MultiplexedSessionRetry>,
>,
>(
mut self,
v: T,
) -> Self {
self.multiplexed_session_retry = v.into();
self
}
pub fn precommit_token(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::MultiplexedSessionPrecommitToken>> {
#[allow(unreachable_patterns)]
self.multiplexed_session_retry
.as_ref()
.and_then(|v| match v {
crate::model::commit_response::MultiplexedSessionRetry::PrecommitToken(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_precommit_token<
T: std::convert::Into<std::boxed::Box<crate::model::MultiplexedSessionPrecommitToken>>,
>(
mut self,
v: T,
) -> Self {
self.multiplexed_session_retry = std::option::Option::Some(
crate::model::commit_response::MultiplexedSessionRetry::PrecommitToken(v.into()),
);
self
}
}
impl wkt::message::Message for CommitResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.CommitResponse"
}
}
pub mod commit_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CommitStats {
pub mutation_count: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CommitStats {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_mutation_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.mutation_count = v.into();
self
}
}
impl wkt::message::Message for CommitStats {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.CommitResponse.CommitStats"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MultiplexedSessionRetry {
PrecommitToken(std::boxed::Box<crate::model::MultiplexedSessionPrecommitToken>),
}
impl MultiplexedSessionRetry {
pub fn from_precommit_token(
value: impl std::convert::Into<
std::boxed::Box<crate::model::MultiplexedSessionPrecommitToken>,
>,
) -> Self {
Self::PrecommitToken(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KeyRange {
pub start_key_type: std::option::Option<crate::model::key_range::StartKeyType>,
pub end_key_type: std::option::Option<crate::model::key_range::EndKeyType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl KeyRange {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_key_type<
T: std::convert::Into<std::option::Option<crate::model::key_range::StartKeyType>>,
>(
mut self,
v: T,
) -> Self {
self.start_key_type = v.into();
self
}
pub fn start_closed(&self) -> std::option::Option<&std::boxed::Box<wkt::ListValue>> {
#[allow(unreachable_patterns)]
self.start_key_type.as_ref().and_then(|v| match v {
crate::model::key_range::StartKeyType::StartClosed(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_start_closed<T: std::convert::Into<std::boxed::Box<wkt::ListValue>>>(
mut self,
v: T,
) -> Self {
self.start_key_type =
std::option::Option::Some(crate::model::key_range::StartKeyType::StartClosed(v.into()));
self
}
pub fn start_open(&self) -> std::option::Option<&std::boxed::Box<wkt::ListValue>> {
#[allow(unreachable_patterns)]
self.start_key_type.as_ref().and_then(|v| match v {
crate::model::key_range::StartKeyType::StartOpen(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_start_open<T: std::convert::Into<std::boxed::Box<wkt::ListValue>>>(
mut self,
v: T,
) -> Self {
self.start_key_type =
std::option::Option::Some(crate::model::key_range::StartKeyType::StartOpen(v.into()));
self
}
pub fn set_end_key_type<
T: std::convert::Into<std::option::Option<crate::model::key_range::EndKeyType>>,
>(
mut self,
v: T,
) -> Self {
self.end_key_type = v.into();
self
}
pub fn end_closed(&self) -> std::option::Option<&std::boxed::Box<wkt::ListValue>> {
#[allow(unreachable_patterns)]
self.end_key_type.as_ref().and_then(|v| match v {
crate::model::key_range::EndKeyType::EndClosed(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_end_closed<T: std::convert::Into<std::boxed::Box<wkt::ListValue>>>(
mut self,
v: T,
) -> Self {
self.end_key_type =
std::option::Option::Some(crate::model::key_range::EndKeyType::EndClosed(v.into()));
self
}
pub fn end_open(&self) -> std::option::Option<&std::boxed::Box<wkt::ListValue>> {
#[allow(unreachable_patterns)]
self.end_key_type.as_ref().and_then(|v| match v {
crate::model::key_range::EndKeyType::EndOpen(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_end_open<T: std::convert::Into<std::boxed::Box<wkt::ListValue>>>(
mut self,
v: T,
) -> Self {
self.end_key_type =
std::option::Option::Some(crate::model::key_range::EndKeyType::EndOpen(v.into()));
self
}
}
impl wkt::message::Message for KeyRange {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.KeyRange"
}
}
pub mod key_range {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StartKeyType {
StartClosed(std::boxed::Box<wkt::ListValue>),
StartOpen(std::boxed::Box<wkt::ListValue>),
}
impl StartKeyType {
pub fn from_start_closed(
value: impl std::convert::Into<std::boxed::Box<wkt::ListValue>>,
) -> Self {
Self::StartClosed(value.into())
}
pub fn from_start_open(
value: impl std::convert::Into<std::boxed::Box<wkt::ListValue>>,
) -> Self {
Self::StartOpen(value.into())
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EndKeyType {
EndClosed(std::boxed::Box<wkt::ListValue>),
EndOpen(std::boxed::Box<wkt::ListValue>),
}
impl EndKeyType {
pub fn from_end_closed(
value: impl std::convert::Into<std::boxed::Box<wkt::ListValue>>,
) -> Self {
Self::EndClosed(value.into())
}
pub fn from_end_open(
value: impl std::convert::Into<std::boxed::Box<wkt::ListValue>>,
) -> Self {
Self::EndOpen(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KeySet {
pub keys: std::vec::Vec<wkt::ListValue>,
pub ranges: std::vec::Vec<crate::model::KeyRange>,
pub all: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl KeySet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_keys<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::ListValue>,
{
use std::iter::Iterator;
self.keys = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_ranges<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::KeyRange>,
{
use std::iter::Iterator;
self.ranges = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.all = v.into();
self
}
}
impl wkt::message::Message for KeySet {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.KeySet"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Range {
pub start_key: ::bytes::Bytes,
pub limit_key: ::bytes::Bytes,
pub group_uid: u64,
pub split_id: u64,
pub generation: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Range {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.start_key = v.into();
self
}
pub fn set_limit_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.limit_key = v.into();
self
}
pub fn set_group_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.group_uid = v.into();
self
}
pub fn set_split_id<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.split_id = v.into();
self
}
pub fn set_generation<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.generation = v.into();
self
}
}
impl wkt::message::Message for Range {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Range"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Tablet {
pub tablet_uid: u64,
pub server_address: std::string::String,
pub location: std::string::String,
pub role: crate::model::tablet::Role,
pub incarnation: ::bytes::Bytes,
pub distance: u32,
pub skip: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Tablet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_tablet_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.tablet_uid = v.into();
self
}
pub fn set_server_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.server_address = v.into();
self
}
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
pub fn set_role<T: std::convert::Into<crate::model::tablet::Role>>(mut self, v: T) -> Self {
self.role = v.into();
self
}
pub fn set_incarnation<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.incarnation = v.into();
self
}
pub fn set_distance<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
self.distance = v.into();
self
}
pub fn set_skip<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.skip = v.into();
self
}
}
impl wkt::message::Message for Tablet {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Tablet"
}
}
pub mod tablet {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Role {
Unspecified,
ReadWrite,
ReadOnly,
UnknownValue(role::UnknownValue),
}
#[doc(hidden)]
pub mod role {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Role {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ReadWrite => std::option::Option::Some(1),
Self::ReadOnly => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Role {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Role {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ReadWrite,
2 => Self::ReadOnly,
_ => Self::UnknownValue(role::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Role {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ROLE_UNSPECIFIED" => Self::Unspecified,
"READ_WRITE" => Self::ReadWrite,
"READ_ONLY" => Self::ReadOnly,
_ => Self::UnknownValue(role::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Role {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ReadWrite => serializer.serialize_i32(1),
Self::ReadOnly => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Role {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
".google.spanner.v1.Tablet.Role",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Group {
pub group_uid: u64,
pub tablets: std::vec::Vec<crate::model::Tablet>,
pub leader_index: i32,
pub generation: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Group {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_group_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.group_uid = v.into();
self
}
pub fn set_tablets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tablet>,
{
use std::iter::Iterator;
self.tablets = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_leader_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.leader_index = v.into();
self
}
pub fn set_generation<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.generation = v.into();
self
}
}
impl wkt::message::Message for Group {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Group"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KeyRecipe {
pub part: std::vec::Vec<crate::model::key_recipe::Part>,
pub target: std::option::Option<crate::model::key_recipe::Target>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl KeyRecipe {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_part<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::key_recipe::Part>,
{
use std::iter::Iterator;
self.part = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_target<
T: std::convert::Into<std::option::Option<crate::model::key_recipe::Target>>,
>(
mut self,
v: T,
) -> Self {
self.target = v.into();
self
}
pub fn table_name(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.target.as_ref().and_then(|v| match v {
crate::model::key_recipe::Target::TableName(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_table_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.target =
std::option::Option::Some(crate::model::key_recipe::Target::TableName(v.into()));
self
}
pub fn index_name(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.target.as_ref().and_then(|v| match v {
crate::model::key_recipe::Target::IndexName(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_index_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.target =
std::option::Option::Some(crate::model::key_recipe::Target::IndexName(v.into()));
self
}
pub fn operation_uid(&self) -> std::option::Option<&u64> {
#[allow(unreachable_patterns)]
self.target.as_ref().and_then(|v| match v {
crate::model::key_recipe::Target::OperationUid(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_operation_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.target =
std::option::Option::Some(crate::model::key_recipe::Target::OperationUid(v.into()));
self
}
}
impl wkt::message::Message for KeyRecipe {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.KeyRecipe"
}
}
pub mod key_recipe {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Part {
pub tag: u32,
pub order: crate::model::key_recipe::part::Order,
pub null_order: crate::model::key_recipe::part::NullOrder,
pub r#type: std::option::Option<crate::model::Type>,
pub struct_identifiers: std::vec::Vec<i32>,
pub value_type: std::option::Option<crate::model::key_recipe::part::ValueType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Part {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_tag<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
self.tag = v.into();
self
}
pub fn set_order<T: std::convert::Into<crate::model::key_recipe::part::Order>>(
mut self,
v: T,
) -> Self {
self.order = v.into();
self
}
pub fn set_null_order<T: std::convert::Into<crate::model::key_recipe::part::NullOrder>>(
mut self,
v: T,
) -> Self {
self.null_order = v.into();
self
}
pub fn set_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.r#type = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.r#type = v.map(|x| x.into());
self
}
pub fn set_struct_identifiers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i32>,
{
use std::iter::Iterator;
self.struct_identifiers = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_value_type<
T: std::convert::Into<std::option::Option<crate::model::key_recipe::part::ValueType>>,
>(
mut self,
v: T,
) -> Self {
self.value_type = v.into();
self
}
pub fn identifier(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.value_type.as_ref().and_then(|v| match v {
crate::model::key_recipe::part::ValueType::Identifier(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_identifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value_type = std::option::Option::Some(
crate::model::key_recipe::part::ValueType::Identifier(v.into()),
);
self
}
pub fn value(&self) -> std::option::Option<&std::boxed::Box<wkt::Value>> {
#[allow(unreachable_patterns)]
self.value_type.as_ref().and_then(|v| match v {
crate::model::key_recipe::part::ValueType::Value(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_value<T: std::convert::Into<std::boxed::Box<wkt::Value>>>(
mut self,
v: T,
) -> Self {
self.value_type = std::option::Option::Some(
crate::model::key_recipe::part::ValueType::Value(v.into()),
);
self
}
pub fn random(&self) -> std::option::Option<&bool> {
#[allow(unreachable_patterns)]
self.value_type.as_ref().and_then(|v| match v {
crate::model::key_recipe::part::ValueType::Random(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_random<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.value_type = std::option::Option::Some(
crate::model::key_recipe::part::ValueType::Random(v.into()),
);
self
}
}
impl wkt::message::Message for Part {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.KeyRecipe.Part"
}
}
pub mod part {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Order {
Unspecified,
Ascending,
Descending,
UnknownValue(order::UnknownValue),
}
#[doc(hidden)]
pub mod order {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Order {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Ascending => std::option::Option::Some(1),
Self::Descending => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ORDER_UNSPECIFIED"),
Self::Ascending => std::option::Option::Some("ASCENDING"),
Self::Descending => std::option::Option::Some("DESCENDING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Order {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Order {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Order {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Ascending,
2 => Self::Descending,
_ => Self::UnknownValue(order::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Order {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ORDER_UNSPECIFIED" => Self::Unspecified,
"ASCENDING" => Self::Ascending,
"DESCENDING" => Self::Descending,
_ => Self::UnknownValue(order::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Order {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Ascending => serializer.serialize_i32(1),
Self::Descending => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Order {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Order>::new(
".google.spanner.v1.KeyRecipe.Part.Order",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NullOrder {
Unspecified,
NullsFirst,
NullsLast,
NotNull,
UnknownValue(null_order::UnknownValue),
}
#[doc(hidden)]
pub mod null_order {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl NullOrder {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NullsFirst => std::option::Option::Some(1),
Self::NullsLast => std::option::Option::Some(2),
Self::NotNull => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("NULL_ORDER_UNSPECIFIED"),
Self::NullsFirst => std::option::Option::Some("NULLS_FIRST"),
Self::NullsLast => std::option::Option::Some("NULLS_LAST"),
Self::NotNull => std::option::Option::Some("NOT_NULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for NullOrder {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for NullOrder {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for NullOrder {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NullsFirst,
2 => Self::NullsLast,
3 => Self::NotNull,
_ => Self::UnknownValue(null_order::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for NullOrder {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NULL_ORDER_UNSPECIFIED" => Self::Unspecified,
"NULLS_FIRST" => Self::NullsFirst,
"NULLS_LAST" => Self::NullsLast,
"NOT_NULL" => Self::NotNull,
_ => Self::UnknownValue(null_order::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for NullOrder {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::NullsFirst => serializer.serialize_i32(1),
Self::NullsLast => serializer.serialize_i32(2),
Self::NotNull => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for NullOrder {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<NullOrder>::new(
".google.spanner.v1.KeyRecipe.Part.NullOrder",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ValueType {
Identifier(std::string::String),
Value(std::boxed::Box<wkt::Value>),
Random(bool),
}
impl ValueType {
pub fn from_identifier(value: impl std::convert::Into<std::string::String>) -> Self {
Self::Identifier(value.into())
}
pub fn from_value(value: impl std::convert::Into<std::boxed::Box<wkt::Value>>) -> Self {
Self::Value(value.into())
}
pub fn from_random(value: impl std::convert::Into<bool>) -> Self {
Self::Random(value.into())
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Target {
TableName(std::string::String),
IndexName(std::string::String),
OperationUid(u64),
}
impl Target {
pub fn from_table_name(value: impl std::convert::Into<std::string::String>) -> Self {
Self::TableName(value.into())
}
pub fn from_index_name(value: impl std::convert::Into<std::string::String>) -> Self {
Self::IndexName(value.into())
}
pub fn from_operation_uid(value: impl std::convert::Into<u64>) -> Self {
Self::OperationUid(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RecipeList {
pub schema_generation: ::bytes::Bytes,
pub recipe: std::vec::Vec<crate::model::KeyRecipe>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecipeList {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_schema_generation<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.schema_generation = v.into();
self
}
pub fn set_recipe<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::KeyRecipe>,
{
use std::iter::Iterator;
self.recipe = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for RecipeList {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.RecipeList"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CacheUpdate {
pub database_id: u64,
pub range: std::vec::Vec<crate::model::Range>,
pub group: std::vec::Vec<crate::model::Group>,
pub key_recipes: std::option::Option<crate::model::RecipeList>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CacheUpdate {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_database_id<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.database_id = v.into();
self
}
pub fn set_range<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Range>,
{
use std::iter::Iterator;
self.range = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_group<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Group>,
{
use std::iter::Iterator;
self.group = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_key_recipes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecipeList>,
{
self.key_recipes = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key_recipes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecipeList>,
{
self.key_recipes = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CacheUpdate {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.CacheUpdate"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RoutingHint {
pub operation_uid: u64,
pub database_id: u64,
pub schema_generation: ::bytes::Bytes,
pub key: ::bytes::Bytes,
pub limit_key: ::bytes::Bytes,
pub group_uid: u64,
pub split_id: u64,
pub tablet_uid: u64,
pub skipped_tablet_uid: std::vec::Vec<crate::model::routing_hint::SkippedTablet>,
pub client_location: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RoutingHint {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_operation_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.operation_uid = v.into();
self
}
pub fn set_database_id<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.database_id = v.into();
self
}
pub fn set_schema_generation<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.schema_generation = v.into();
self
}
pub fn set_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
pub fn set_limit_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.limit_key = v.into();
self
}
pub fn set_group_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.group_uid = v.into();
self
}
pub fn set_split_id<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.split_id = v.into();
self
}
pub fn set_tablet_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.tablet_uid = v.into();
self
}
pub fn set_skipped_tablet_uid<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::routing_hint::SkippedTablet>,
{
use std::iter::Iterator;
self.skipped_tablet_uid = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_client_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.client_location = v.into();
self
}
}
impl wkt::message::Message for RoutingHint {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.RoutingHint"
}
}
pub mod routing_hint {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SkippedTablet {
pub tablet_uid: u64,
pub incarnation: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SkippedTablet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_tablet_uid<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.tablet_uid = v.into();
self
}
pub fn set_incarnation<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.incarnation = v.into();
self
}
}
impl wkt::message::Message for SkippedTablet {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.RoutingHint.SkippedTablet"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Mutation {
pub operation: std::option::Option<crate::model::mutation::Operation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Mutation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_operation<
T: std::convert::Into<std::option::Option<crate::model::mutation::Operation>>,
>(
mut self,
v: T,
) -> Self {
self.operation = v.into();
self
}
pub fn insert(&self) -> std::option::Option<&std::boxed::Box<crate::model::mutation::Write>> {
#[allow(unreachable_patterns)]
self.operation.as_ref().and_then(|v| match v {
crate::model::mutation::Operation::Insert(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_insert<T: std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>>(
mut self,
v: T,
) -> Self {
self.operation =
std::option::Option::Some(crate::model::mutation::Operation::Insert(v.into()));
self
}
pub fn update(&self) -> std::option::Option<&std::boxed::Box<crate::model::mutation::Write>> {
#[allow(unreachable_patterns)]
self.operation.as_ref().and_then(|v| match v {
crate::model::mutation::Operation::Update(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_update<T: std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>>(
mut self,
v: T,
) -> Self {
self.operation =
std::option::Option::Some(crate::model::mutation::Operation::Update(v.into()));
self
}
pub fn insert_or_update(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::mutation::Write>> {
#[allow(unreachable_patterns)]
self.operation.as_ref().and_then(|v| match v {
crate::model::mutation::Operation::InsertOrUpdate(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_insert_or_update<
T: std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>,
>(
mut self,
v: T,
) -> Self {
self.operation =
std::option::Option::Some(crate::model::mutation::Operation::InsertOrUpdate(v.into()));
self
}
pub fn replace(&self) -> std::option::Option<&std::boxed::Box<crate::model::mutation::Write>> {
#[allow(unreachable_patterns)]
self.operation.as_ref().and_then(|v| match v {
crate::model::mutation::Operation::Replace(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_replace<T: std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>>(
mut self,
v: T,
) -> Self {
self.operation =
std::option::Option::Some(crate::model::mutation::Operation::Replace(v.into()));
self
}
pub fn delete(&self) -> std::option::Option<&std::boxed::Box<crate::model::mutation::Delete>> {
#[allow(unreachable_patterns)]
self.operation.as_ref().and_then(|v| match v {
crate::model::mutation::Operation::Delete(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_delete<T: std::convert::Into<std::boxed::Box<crate::model::mutation::Delete>>>(
mut self,
v: T,
) -> Self {
self.operation =
std::option::Option::Some(crate::model::mutation::Operation::Delete(v.into()));
self
}
pub fn send(&self) -> std::option::Option<&std::boxed::Box<crate::model::mutation::Send>> {
#[allow(unreachable_patterns)]
self.operation.as_ref().and_then(|v| match v {
crate::model::mutation::Operation::Send(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_send<T: std::convert::Into<std::boxed::Box<crate::model::mutation::Send>>>(
mut self,
v: T,
) -> Self {
self.operation =
std::option::Option::Some(crate::model::mutation::Operation::Send(v.into()));
self
}
pub fn ack(&self) -> std::option::Option<&std::boxed::Box<crate::model::mutation::Ack>> {
#[allow(unreachable_patterns)]
self.operation.as_ref().and_then(|v| match v {
crate::model::mutation::Operation::Ack(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_ack<T: std::convert::Into<std::boxed::Box<crate::model::mutation::Ack>>>(
mut self,
v: T,
) -> Self {
self.operation =
std::option::Option::Some(crate::model::mutation::Operation::Ack(v.into()));
self
}
}
impl wkt::message::Message for Mutation {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Mutation"
}
}
pub mod mutation {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Write {
pub table: std::string::String,
pub columns: std::vec::Vec<std::string::String>,
pub values: std::vec::Vec<wkt::ListValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Write {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table = v.into();
self
}
pub fn set_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.columns = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::ListValue>,
{
use std::iter::Iterator;
self.values = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Write {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Mutation.Write"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Delete {
pub table: std::string::String,
pub key_set: std::option::Option<crate::model::KeySet>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Delete {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table = v.into();
self
}
pub fn set_key_set<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::KeySet>,
{
self.key_set = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key_set<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::KeySet>,
{
self.key_set = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Delete {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Mutation.Delete"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Send {
pub queue: std::string::String,
pub key: std::option::Option<wkt::ListValue>,
pub deliver_time: std::option::Option<wkt::Timestamp>,
pub payload: std::option::Option<wkt::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Send {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_queue<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.queue = v.into();
self
}
pub fn set_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::ListValue>,
{
self.key = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::ListValue>,
{
self.key = v.map(|x| x.into());
self
}
pub fn set_deliver_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.deliver_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_deliver_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.deliver_time = v.map(|x| x.into());
self
}
pub fn set_payload<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.payload = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.payload = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Send {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Mutation.Send"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Ack {
pub queue: std::string::String,
pub key: std::option::Option<wkt::ListValue>,
pub ignore_not_found: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Ack {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_queue<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.queue = v.into();
self
}
pub fn set_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::ListValue>,
{
self.key = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::ListValue>,
{
self.key = v.map(|x| x.into());
self
}
pub fn set_ignore_not_found<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.ignore_not_found = v.into();
self
}
}
impl wkt::message::Message for Ack {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Mutation.Ack"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Operation {
Insert(std::boxed::Box<crate::model::mutation::Write>),
Update(std::boxed::Box<crate::model::mutation::Write>),
InsertOrUpdate(std::boxed::Box<crate::model::mutation::Write>),
Replace(std::boxed::Box<crate::model::mutation::Write>),
Delete(std::boxed::Box<crate::model::mutation::Delete>),
Send(std::boxed::Box<crate::model::mutation::Send>),
Ack(std::boxed::Box<crate::model::mutation::Ack>),
}
impl Operation {
pub fn from_insert(
value: impl std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>,
) -> Self {
Self::Insert(value.into())
}
pub fn from_update(
value: impl std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>,
) -> Self {
Self::Update(value.into())
}
pub fn from_insert_or_update(
value: impl std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>,
) -> Self {
Self::InsertOrUpdate(value.into())
}
pub fn from_replace(
value: impl std::convert::Into<std::boxed::Box<crate::model::mutation::Write>>,
) -> Self {
Self::Replace(value.into())
}
pub fn from_delete(
value: impl std::convert::Into<std::boxed::Box<crate::model::mutation::Delete>>,
) -> Self {
Self::Delete(value.into())
}
pub fn from_send(
value: impl std::convert::Into<std::boxed::Box<crate::model::mutation::Send>>,
) -> Self {
Self::Send(value.into())
}
pub fn from_ack(
value: impl std::convert::Into<std::boxed::Box<crate::model::mutation::Ack>>,
) -> Self {
Self::Ack(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PlanNode {
pub index: i32,
pub kind: crate::model::plan_node::Kind,
pub display_name: std::string::String,
pub child_links: std::vec::Vec<crate::model::plan_node::ChildLink>,
pub short_representation: std::option::Option<crate::model::plan_node::ShortRepresentation>,
pub metadata: std::option::Option<wkt::Struct>,
pub execution_stats: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PlanNode {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.index = v.into();
self
}
pub fn set_kind<T: std::convert::Into<crate::model::plan_node::Kind>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_child_links<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::plan_node::ChildLink>,
{
use std::iter::Iterator;
self.child_links = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_short_representation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::plan_node::ShortRepresentation>,
{
self.short_representation = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_short_representation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::plan_node::ShortRepresentation>,
{
self.short_representation = v.map(|x| x.into());
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.metadata = v.map(|x| x.into());
self
}
pub fn set_execution_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.execution_stats = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_execution_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.execution_stats = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PlanNode {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PlanNode"
}
}
pub mod plan_node {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ChildLink {
pub child_index: i32,
pub r#type: std::string::String,
pub variable: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ChildLink {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_child_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.child_index = v.into();
self
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_variable<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.variable = v.into();
self
}
}
impl wkt::message::Message for ChildLink {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PlanNode.ChildLink"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ShortRepresentation {
pub description: std::string::String,
pub subqueries: std::collections::HashMap<std::string::String, i32>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ShortRepresentation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_subqueries<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<i32>,
{
use std::iter::Iterator;
self.subqueries = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for ShortRepresentation {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PlanNode.ShortRepresentation"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Kind {
Unspecified,
Relational,
Scalar,
UnknownValue(kind::UnknownValue),
}
#[doc(hidden)]
pub mod kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Kind {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Relational => std::option::Option::Some(1),
Self::Scalar => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("KIND_UNSPECIFIED"),
Self::Relational => std::option::Option::Some("RELATIONAL"),
Self::Scalar => std::option::Option::Some("SCALAR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Kind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Kind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Kind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Relational,
2 => Self::Scalar,
_ => Self::UnknownValue(kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Kind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"KIND_UNSPECIFIED" => Self::Unspecified,
"RELATIONAL" => Self::Relational,
"SCALAR" => Self::Scalar,
_ => Self::UnknownValue(kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Kind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Relational => serializer.serialize_i32(1),
Self::Scalar => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Kind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
".google.spanner.v1.PlanNode.Kind",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryAdvisorResult {
pub index_advice: std::vec::Vec<crate::model::query_advisor_result::IndexAdvice>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryAdvisorResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_index_advice<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::query_advisor_result::IndexAdvice>,
{
use std::iter::Iterator;
self.index_advice = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for QueryAdvisorResult {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.QueryAdvisorResult"
}
}
pub mod query_advisor_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IndexAdvice {
pub ddl: std::vec::Vec<std::string::String>,
pub improvement_factor: f64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IndexAdvice {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_ddl<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.ddl = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_improvement_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.improvement_factor = v.into();
self
}
}
impl wkt::message::Message for IndexAdvice {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.QueryAdvisorResult.IndexAdvice"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryPlan {
pub plan_nodes: std::vec::Vec<crate::model::PlanNode>,
pub query_advice: std::option::Option<crate::model::QueryAdvisorResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryPlan {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_plan_nodes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::PlanNode>,
{
use std::iter::Iterator;
self.plan_nodes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_query_advice<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryAdvisorResult>,
{
self.query_advice = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_query_advice<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryAdvisorResult>,
{
self.query_advice = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for QueryPlan {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.QueryPlan"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResultSet {
pub metadata: std::option::Option<crate::model::ResultSetMetadata>,
pub rows: std::vec::Vec<wkt::ListValue>,
pub stats: std::option::Option<crate::model::ResultSetStats>,
pub precommit_token: std::option::Option<crate::model::MultiplexedSessionPrecommitToken>,
pub cache_update: std::option::Option<crate::model::CacheUpdate>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResultSet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ResultSetMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ResultSetMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
pub fn set_rows<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::ListValue>,
{
use std::iter::Iterator;
self.rows = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ResultSetStats>,
{
self.stats = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ResultSetStats>,
{
self.stats = v.map(|x| x.into());
self
}
pub fn set_precommit_token<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_precommit_token<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = v.map(|x| x.into());
self
}
pub fn set_cache_update<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cache_update<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ResultSet {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ResultSet"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartialResultSet {
pub metadata: std::option::Option<crate::model::ResultSetMetadata>,
pub values: std::vec::Vec<wkt::Value>,
pub chunked_value: bool,
pub resume_token: ::bytes::Bytes,
pub stats: std::option::Option<crate::model::ResultSetStats>,
pub precommit_token: std::option::Option<crate::model::MultiplexedSessionPrecommitToken>,
pub last: bool,
pub cache_update: std::option::Option<crate::model::CacheUpdate>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartialResultSet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ResultSetMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ResultSetMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
pub fn set_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.values = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_chunked_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.chunked_value = v.into();
self
}
pub fn set_resume_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.resume_token = v.into();
self
}
pub fn set_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ResultSetStats>,
{
self.stats = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ResultSetStats>,
{
self.stats = v.map(|x| x.into());
self
}
pub fn set_precommit_token<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_precommit_token<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = v.map(|x| x.into());
self
}
pub fn set_last<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.last = v.into();
self
}
pub fn set_cache_update<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cache_update<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PartialResultSet {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PartialResultSet"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResultSetMetadata {
pub row_type: std::option::Option<crate::model::StructType>,
pub transaction: std::option::Option<crate::model::Transaction>,
pub undeclared_parameters: std::option::Option<crate::model::StructType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResultSetMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_row_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StructType>,
{
self.row_type = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_row_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StructType>,
{
self.row_type = v.map(|x| x.into());
self
}
pub fn set_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Transaction>,
{
self.transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Transaction>,
{
self.transaction = v.map(|x| x.into());
self
}
pub fn set_undeclared_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StructType>,
{
self.undeclared_parameters = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_undeclared_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StructType>,
{
self.undeclared_parameters = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ResultSetMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ResultSetMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResultSetStats {
pub query_plan: std::option::Option<crate::model::QueryPlan>,
pub query_stats: std::option::Option<wkt::Struct>,
pub row_count: std::option::Option<crate::model::result_set_stats::RowCount>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResultSetStats {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_query_plan<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryPlan>,
{
self.query_plan = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_query_plan<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryPlan>,
{
self.query_plan = v.map(|x| x.into());
self
}
pub fn set_query_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.query_stats = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_query_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.query_stats = v.map(|x| x.into());
self
}
pub fn set_row_count<
T: std::convert::Into<std::option::Option<crate::model::result_set_stats::RowCount>>,
>(
mut self,
v: T,
) -> Self {
self.row_count = v.into();
self
}
pub fn row_count_exact(&self) -> std::option::Option<&i64> {
#[allow(unreachable_patterns)]
self.row_count.as_ref().and_then(|v| match v {
crate::model::result_set_stats::RowCount::RowCountExact(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_row_count_exact<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.row_count = std::option::Option::Some(
crate::model::result_set_stats::RowCount::RowCountExact(v.into()),
);
self
}
pub fn row_count_lower_bound(&self) -> std::option::Option<&i64> {
#[allow(unreachable_patterns)]
self.row_count.as_ref().and_then(|v| match v {
crate::model::result_set_stats::RowCount::RowCountLowerBound(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_row_count_lower_bound<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.row_count = std::option::Option::Some(
crate::model::result_set_stats::RowCount::RowCountLowerBound(v.into()),
);
self
}
}
impl wkt::message::Message for ResultSetStats {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ResultSetStats"
}
}
pub mod result_set_stats {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RowCount {
RowCountExact(i64),
RowCountLowerBound(i64),
}
impl RowCount {
pub fn from_row_count_exact(value: impl std::convert::Into<i64>) -> Self {
Self::RowCountExact(value.into())
}
pub fn from_row_count_lower_bound(value: impl std::convert::Into<i64>) -> Self {
Self::RowCountLowerBound(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateSessionRequest {
pub database: std::string::String,
pub session: std::option::Option<crate::model::Session>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateSessionRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.database = v.into();
self
}
pub fn set_session<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.session = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.session = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateSessionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.CreateSessionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchCreateSessionsRequest {
pub database: std::string::String,
pub session_template: std::option::Option<crate::model::Session>,
pub session_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchCreateSessionsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.database = v.into();
self
}
pub fn set_session_template<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.session_template = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.session_template = v.map(|x| x.into());
self
}
pub fn set_session_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.session_count = v.into();
self
}
}
impl wkt::message::Message for BatchCreateSessionsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.BatchCreateSessionsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchCreateSessionsResponse {
pub session: std::vec::Vec<crate::model::Session>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchCreateSessionsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Session>,
{
use std::iter::Iterator;
self.session = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchCreateSessionsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.BatchCreateSessionsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Session {
pub name: std::string::String,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub approximate_last_use_time: std::option::Option<wkt::Timestamp>,
pub creator_role: std::string::String,
pub multiplexed: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Session {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_approximate_last_use_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.approximate_last_use_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_approximate_last_use_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.approximate_last_use_time = v.map(|x| x.into());
self
}
pub fn set_creator_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.creator_role = v.into();
self
}
pub fn set_multiplexed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.multiplexed = v.into();
self
}
}
impl wkt::message::Message for Session {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Session"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSessionRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetSessionRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetSessionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.GetSessionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSessionsRequest {
pub database: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListSessionsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.database = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
impl wkt::message::Message for ListSessionsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ListSessionsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSessionsResponse {
pub sessions: std::vec::Vec<crate::model::Session>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListSessionsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sessions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Session>,
{
use std::iter::Iterator;
self.sessions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListSessionsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ListSessionsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionsResponse {
type PageItem = crate::model::Session;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.sessions
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteSessionRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteSessionRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteSessionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.DeleteSessionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RequestOptions {
pub priority: crate::model::request_options::Priority,
pub request_tag: std::string::String,
pub transaction_tag: std::string::String,
pub client_context: std::option::Option<crate::model::request_options::ClientContext>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RequestOptions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_priority<T: std::convert::Into<crate::model::request_options::Priority>>(
mut self,
v: T,
) -> Self {
self.priority = v.into();
self
}
pub fn set_request_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_tag = v.into();
self
}
pub fn set_transaction_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.transaction_tag = v.into();
self
}
pub fn set_client_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::request_options::ClientContext>,
{
self.client_context = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_client_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::request_options::ClientContext>,
{
self.client_context = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RequestOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.RequestOptions"
}
}
pub mod request_options {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClientContext {
pub secure_context: std::collections::HashMap<std::string::String, wkt::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ClientContext {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_secure_context<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.secure_context = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for ClientContext {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.RequestOptions.ClientContext"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Priority {
Unspecified,
Low,
Medium,
High,
UnknownValue(priority::UnknownValue),
}
#[doc(hidden)]
pub mod priority {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Priority {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Low => std::option::Option::Some(1),
Self::Medium => std::option::Option::Some(2),
Self::High => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
Self::Low => std::option::Option::Some("PRIORITY_LOW"),
Self::Medium => std::option::Option::Some("PRIORITY_MEDIUM"),
Self::High => std::option::Option::Some("PRIORITY_HIGH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Priority {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Priority {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Priority {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Low,
2 => Self::Medium,
3 => Self::High,
_ => Self::UnknownValue(priority::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Priority {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PRIORITY_UNSPECIFIED" => Self::Unspecified,
"PRIORITY_LOW" => Self::Low,
"PRIORITY_MEDIUM" => Self::Medium,
"PRIORITY_HIGH" => Self::High,
_ => Self::UnknownValue(priority::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Priority {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Low => serializer.serialize_i32(1),
Self::Medium => serializer.serialize_i32(2),
Self::High => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Priority {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
".google.spanner.v1.RequestOptions.Priority",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DirectedReadOptions {
pub replicas: std::option::Option<crate::model::directed_read_options::Replicas>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DirectedReadOptions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_replicas<
T: std::convert::Into<std::option::Option<crate::model::directed_read_options::Replicas>>,
>(
mut self,
v: T,
) -> Self {
self.replicas = v.into();
self
}
pub fn include_replicas(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::directed_read_options::IncludeReplicas>>
{
#[allow(unreachable_patterns)]
self.replicas.as_ref().and_then(|v| match v {
crate::model::directed_read_options::Replicas::IncludeReplicas(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_include_replicas<
T: std::convert::Into<std::boxed::Box<crate::model::directed_read_options::IncludeReplicas>>,
>(
mut self,
v: T,
) -> Self {
self.replicas = std::option::Option::Some(
crate::model::directed_read_options::Replicas::IncludeReplicas(v.into()),
);
self
}
pub fn exclude_replicas(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::directed_read_options::ExcludeReplicas>>
{
#[allow(unreachable_patterns)]
self.replicas.as_ref().and_then(|v| match v {
crate::model::directed_read_options::Replicas::ExcludeReplicas(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_exclude_replicas<
T: std::convert::Into<std::boxed::Box<crate::model::directed_read_options::ExcludeReplicas>>,
>(
mut self,
v: T,
) -> Self {
self.replicas = std::option::Option::Some(
crate::model::directed_read_options::Replicas::ExcludeReplicas(v.into()),
);
self
}
}
impl wkt::message::Message for DirectedReadOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.DirectedReadOptions"
}
}
pub mod directed_read_options {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReplicaSelection {
pub location: std::string::String,
pub r#type: crate::model::directed_read_options::replica_selection::Type,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ReplicaSelection {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
pub fn set_type<
T: std::convert::Into<crate::model::directed_read_options::replica_selection::Type>,
>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
}
impl wkt::message::Message for ReplicaSelection {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.DirectedReadOptions.ReplicaSelection"
}
}
pub mod replica_selection {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
Unspecified,
ReadWrite,
ReadOnly,
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Type {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ReadWrite => std::option::Option::Some(1),
Self::ReadOnly => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Type {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ReadWrite,
2 => Self::ReadOnly,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"READ_WRITE" => Self::ReadWrite,
"READ_ONLY" => Self::ReadOnly,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Type {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ReadWrite => serializer.serialize_i32(1),
Self::ReadOnly => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Type {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
".google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IncludeReplicas {
pub replica_selections:
std::vec::Vec<crate::model::directed_read_options::ReplicaSelection>,
pub auto_failover_disabled: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IncludeReplicas {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_replica_selections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::directed_read_options::ReplicaSelection>,
{
use std::iter::Iterator;
self.replica_selections = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_auto_failover_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.auto_failover_disabled = v.into();
self
}
}
impl wkt::message::Message for IncludeReplicas {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.DirectedReadOptions.IncludeReplicas"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExcludeReplicas {
pub replica_selections:
std::vec::Vec<crate::model::directed_read_options::ReplicaSelection>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExcludeReplicas {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_replica_selections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::directed_read_options::ReplicaSelection>,
{
use std::iter::Iterator;
self.replica_selections = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ExcludeReplicas {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.DirectedReadOptions.ExcludeReplicas"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Replicas {
IncludeReplicas(std::boxed::Box<crate::model::directed_read_options::IncludeReplicas>),
ExcludeReplicas(std::boxed::Box<crate::model::directed_read_options::ExcludeReplicas>),
}
impl Replicas {
pub fn from_include_replicas(
value: impl std::convert::Into<
std::boxed::Box<crate::model::directed_read_options::IncludeReplicas>,
>,
) -> Self {
Self::IncludeReplicas(value.into())
}
pub fn from_exclude_replicas(
value: impl std::convert::Into<
std::boxed::Box<crate::model::directed_read_options::ExcludeReplicas>,
>,
) -> Self {
Self::ExcludeReplicas(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExecuteSqlRequest {
pub session: std::string::String,
pub transaction: std::option::Option<crate::model::TransactionSelector>,
pub sql: std::string::String,
pub params: std::option::Option<wkt::Struct>,
pub param_types: std::collections::HashMap<std::string::String, crate::model::Type>,
pub resume_token: ::bytes::Bytes,
pub query_mode: crate::model::execute_sql_request::QueryMode,
pub partition_token: ::bytes::Bytes,
pub seqno: i64,
pub query_options: std::option::Option<crate::model::execute_sql_request::QueryOptions>,
pub request_options: std::option::Option<crate::model::RequestOptions>,
pub directed_read_options: std::option::Option<crate::model::DirectedReadOptions>,
pub data_boost_enabled: bool,
pub last_statement: bool,
pub routing_hint: std::option::Option<crate::model::RoutingHint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExecuteSqlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = v.map(|x| x.into());
self
}
pub fn set_sql<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.sql = v.into();
self
}
pub fn set_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.params = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.params = v.map(|x| x.into());
self
}
pub fn set_param_types<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::Type>,
{
use std::iter::Iterator;
self.param_types = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_resume_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.resume_token = v.into();
self
}
pub fn set_query_mode<T: std::convert::Into<crate::model::execute_sql_request::QueryMode>>(
mut self,
v: T,
) -> Self {
self.query_mode = v.into();
self
}
pub fn set_partition_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.partition_token = v.into();
self
}
pub fn set_seqno<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.seqno = v.into();
self
}
pub fn set_query_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::execute_sql_request::QueryOptions>,
{
self.query_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_query_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::execute_sql_request::QueryOptions>,
{
self.query_options = v.map(|x| x.into());
self
}
pub fn set_request_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_request_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = v.map(|x| x.into());
self
}
pub fn set_directed_read_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DirectedReadOptions>,
{
self.directed_read_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_directed_read_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DirectedReadOptions>,
{
self.directed_read_options = v.map(|x| x.into());
self
}
pub fn set_data_boost_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.data_boost_enabled = v.into();
self
}
pub fn set_last_statement<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.last_statement = v.into();
self
}
pub fn set_routing_hint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_routing_hint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ExecuteSqlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ExecuteSqlRequest"
}
}
pub mod execute_sql_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryOptions {
pub optimizer_version: std::string::String,
pub optimizer_statistics_package: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryOptions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_optimizer_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.optimizer_version = v.into();
self
}
pub fn set_optimizer_statistics_package<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.optimizer_statistics_package = v.into();
self
}
}
impl wkt::message::Message for QueryOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ExecuteSqlRequest.QueryOptions"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QueryMode {
Normal,
Plan,
Profile,
WithStats,
WithPlanAndStats,
UnknownValue(query_mode::UnknownValue),
}
#[doc(hidden)]
pub mod query_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl QueryMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Normal => std::option::Option::Some(0),
Self::Plan => std::option::Option::Some(1),
Self::Profile => std::option::Option::Some(2),
Self::WithStats => std::option::Option::Some(3),
Self::WithPlanAndStats => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Normal => std::option::Option::Some("NORMAL"),
Self::Plan => std::option::Option::Some("PLAN"),
Self::Profile => std::option::Option::Some("PROFILE"),
Self::WithStats => std::option::Option::Some("WITH_STATS"),
Self::WithPlanAndStats => std::option::Option::Some("WITH_PLAN_AND_STATS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for QueryMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for QueryMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for QueryMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Normal,
1 => Self::Plan,
2 => Self::Profile,
3 => Self::WithStats,
4 => Self::WithPlanAndStats,
_ => Self::UnknownValue(query_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for QueryMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NORMAL" => Self::Normal,
"PLAN" => Self::Plan,
"PROFILE" => Self::Profile,
"WITH_STATS" => Self::WithStats,
"WITH_PLAN_AND_STATS" => Self::WithPlanAndStats,
_ => Self::UnknownValue(query_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for QueryMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Normal => serializer.serialize_i32(0),
Self::Plan => serializer.serialize_i32(1),
Self::Profile => serializer.serialize_i32(2),
Self::WithStats => serializer.serialize_i32(3),
Self::WithPlanAndStats => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for QueryMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<QueryMode>::new(
".google.spanner.v1.ExecuteSqlRequest.QueryMode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExecuteBatchDmlRequest {
pub session: std::string::String,
pub transaction: std::option::Option<crate::model::TransactionSelector>,
pub statements: std::vec::Vec<crate::model::execute_batch_dml_request::Statement>,
pub seqno: i64,
pub request_options: std::option::Option<crate::model::RequestOptions>,
pub last_statements: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExecuteBatchDmlRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = v.map(|x| x.into());
self
}
pub fn set_statements<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::execute_batch_dml_request::Statement>,
{
use std::iter::Iterator;
self.statements = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_seqno<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.seqno = v.into();
self
}
pub fn set_request_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_request_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = v.map(|x| x.into());
self
}
pub fn set_last_statements<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.last_statements = v.into();
self
}
}
impl wkt::message::Message for ExecuteBatchDmlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ExecuteBatchDmlRequest"
}
}
pub mod execute_batch_dml_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Statement {
pub sql: std::string::String,
pub params: std::option::Option<wkt::Struct>,
pub param_types: std::collections::HashMap<std::string::String, crate::model::Type>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Statement {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sql<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.sql = v.into();
self
}
pub fn set_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.params = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.params = v.map(|x| x.into());
self
}
pub fn set_param_types<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::Type>,
{
use std::iter::Iterator;
self.param_types = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Statement {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ExecuteBatchDmlRequest.Statement"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExecuteBatchDmlResponse {
pub result_sets: std::vec::Vec<crate::model::ResultSet>,
pub status: std::option::Option<google_cloud_rpc::model::Status>,
pub precommit_token: std::option::Option<crate::model::MultiplexedSessionPrecommitToken>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExecuteBatchDmlResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_result_sets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ResultSet>,
{
use std::iter::Iterator;
self.result_sets = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.status = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.status = v.map(|x| x.into());
self
}
pub fn set_precommit_token<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_precommit_token<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ExecuteBatchDmlResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ExecuteBatchDmlResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionOptions {
pub partition_size_bytes: i64,
pub max_partitions: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionOptions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_partition_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.partition_size_bytes = v.into();
self
}
pub fn set_max_partitions<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_partitions = v.into();
self
}
}
impl wkt::message::Message for PartitionOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PartitionOptions"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionQueryRequest {
pub session: std::string::String,
pub transaction: std::option::Option<crate::model::TransactionSelector>,
pub sql: std::string::String,
pub params: std::option::Option<wkt::Struct>,
pub param_types: std::collections::HashMap<std::string::String, crate::model::Type>,
pub partition_options: std::option::Option<crate::model::PartitionOptions>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionQueryRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = v.map(|x| x.into());
self
}
pub fn set_sql<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.sql = v.into();
self
}
pub fn set_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.params = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.params = v.map(|x| x.into());
self
}
pub fn set_param_types<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::Type>,
{
use std::iter::Iterator;
self.param_types = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_partition_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PartitionOptions>,
{
self.partition_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_partition_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PartitionOptions>,
{
self.partition_options = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PartitionQueryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PartitionQueryRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionReadRequest {
pub session: std::string::String,
pub transaction: std::option::Option<crate::model::TransactionSelector>,
pub table: std::string::String,
pub index: std::string::String,
pub columns: std::vec::Vec<std::string::String>,
pub key_set: std::option::Option<crate::model::KeySet>,
pub partition_options: std::option::Option<crate::model::PartitionOptions>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionReadRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = v.map(|x| x.into());
self
}
pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table = v.into();
self
}
pub fn set_index<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.index = v.into();
self
}
pub fn set_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.columns = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_key_set<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::KeySet>,
{
self.key_set = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key_set<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::KeySet>,
{
self.key_set = v.map(|x| x.into());
self
}
pub fn set_partition_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PartitionOptions>,
{
self.partition_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_partition_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PartitionOptions>,
{
self.partition_options = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PartitionReadRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PartitionReadRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Partition {
pub partition_token: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Partition {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_partition_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.partition_token = v.into();
self
}
}
impl wkt::message::Message for Partition {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Partition"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionResponse {
pub partitions: std::vec::Vec<crate::model::Partition>,
pub transaction: std::option::Option<crate::model::Transaction>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_partitions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Partition>,
{
use std::iter::Iterator;
self.partitions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Transaction>,
{
self.transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Transaction>,
{
self.transaction = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PartitionResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.PartitionResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReadRequest {
pub session: std::string::String,
pub transaction: std::option::Option<crate::model::TransactionSelector>,
pub table: std::string::String,
pub index: std::string::String,
pub columns: std::vec::Vec<std::string::String>,
pub key_set: std::option::Option<crate::model::KeySet>,
pub limit: i64,
pub resume_token: ::bytes::Bytes,
pub partition_token: ::bytes::Bytes,
pub request_options: std::option::Option<crate::model::RequestOptions>,
pub directed_read_options: std::option::Option<crate::model::DirectedReadOptions>,
pub data_boost_enabled: bool,
pub order_by: crate::model::read_request::OrderBy,
pub lock_hint: crate::model::read_request::LockHint,
pub routing_hint: std::option::Option<crate::model::RoutingHint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ReadRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_transaction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transaction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TransactionSelector>,
{
self.transaction = v.map(|x| x.into());
self
}
pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table = v.into();
self
}
pub fn set_index<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.index = v.into();
self
}
pub fn set_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.columns = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_key_set<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::KeySet>,
{
self.key_set = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key_set<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::KeySet>,
{
self.key_set = v.map(|x| x.into());
self
}
pub fn set_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.limit = v.into();
self
}
pub fn set_resume_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.resume_token = v.into();
self
}
pub fn set_partition_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.partition_token = v.into();
self
}
pub fn set_request_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_request_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = v.map(|x| x.into());
self
}
pub fn set_directed_read_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DirectedReadOptions>,
{
self.directed_read_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_directed_read_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DirectedReadOptions>,
{
self.directed_read_options = v.map(|x| x.into());
self
}
pub fn set_data_boost_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.data_boost_enabled = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<crate::model::read_request::OrderBy>>(
mut self,
v: T,
) -> Self {
self.order_by = v.into();
self
}
pub fn set_lock_hint<T: std::convert::Into<crate::model::read_request::LockHint>>(
mut self,
v: T,
) -> Self {
self.lock_hint = v.into();
self
}
pub fn set_routing_hint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_routing_hint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ReadRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.ReadRequest"
}
}
pub mod read_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OrderBy {
Unspecified,
PrimaryKey,
NoOrder,
UnknownValue(order_by::UnknownValue),
}
#[doc(hidden)]
pub mod order_by {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl OrderBy {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::PrimaryKey => std::option::Option::Some(1),
Self::NoOrder => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ORDER_BY_UNSPECIFIED"),
Self::PrimaryKey => std::option::Option::Some("ORDER_BY_PRIMARY_KEY"),
Self::NoOrder => std::option::Option::Some("ORDER_BY_NO_ORDER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for OrderBy {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for OrderBy {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for OrderBy {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::PrimaryKey,
2 => Self::NoOrder,
_ => Self::UnknownValue(order_by::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for OrderBy {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ORDER_BY_UNSPECIFIED" => Self::Unspecified,
"ORDER_BY_PRIMARY_KEY" => Self::PrimaryKey,
"ORDER_BY_NO_ORDER" => Self::NoOrder,
_ => Self::UnknownValue(order_by::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for OrderBy {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::PrimaryKey => serializer.serialize_i32(1),
Self::NoOrder => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for OrderBy {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OrderBy>::new(
".google.spanner.v1.ReadRequest.OrderBy",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LockHint {
Unspecified,
Shared,
Exclusive,
UnknownValue(lock_hint::UnknownValue),
}
#[doc(hidden)]
pub mod lock_hint {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl LockHint {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Shared => std::option::Option::Some(1),
Self::Exclusive => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("LOCK_HINT_UNSPECIFIED"),
Self::Shared => std::option::Option::Some("LOCK_HINT_SHARED"),
Self::Exclusive => std::option::Option::Some("LOCK_HINT_EXCLUSIVE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for LockHint {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for LockHint {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for LockHint {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Shared,
2 => Self::Exclusive,
_ => Self::UnknownValue(lock_hint::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for LockHint {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"LOCK_HINT_UNSPECIFIED" => Self::Unspecified,
"LOCK_HINT_SHARED" => Self::Shared,
"LOCK_HINT_EXCLUSIVE" => Self::Exclusive,
_ => Self::UnknownValue(lock_hint::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for LockHint {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Shared => serializer.serialize_i32(1),
Self::Exclusive => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for LockHint {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<LockHint>::new(
".google.spanner.v1.ReadRequest.LockHint",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BeginTransactionRequest {
pub session: std::string::String,
pub options: std::option::Option<crate::model::TransactionOptions>,
pub request_options: std::option::Option<crate::model::RequestOptions>,
pub mutation_key: std::option::Option<crate::model::Mutation>,
pub routing_hint: std::option::Option<crate::model::RoutingHint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BeginTransactionRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TransactionOptions>,
{
self.options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TransactionOptions>,
{
self.options = v.map(|x| x.into());
self
}
pub fn set_request_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_request_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = v.map(|x| x.into());
self
}
pub fn set_mutation_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Mutation>,
{
self.mutation_key = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_mutation_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Mutation>,
{
self.mutation_key = v.map(|x| x.into());
self
}
pub fn set_routing_hint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_routing_hint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BeginTransactionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.BeginTransactionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CommitRequest {
pub session: std::string::String,
pub mutations: std::vec::Vec<crate::model::Mutation>,
pub return_commit_stats: bool,
pub max_commit_delay: std::option::Option<wkt::Duration>,
pub request_options: std::option::Option<crate::model::RequestOptions>,
pub precommit_token: std::option::Option<crate::model::MultiplexedSessionPrecommitToken>,
pub routing_hint: std::option::Option<crate::model::RoutingHint>,
pub transaction: std::option::Option<crate::model::commit_request::Transaction>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CommitRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_mutations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Mutation>,
{
use std::iter::Iterator;
self.mutations = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_return_commit_stats<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.return_commit_stats = v.into();
self
}
pub fn set_max_commit_delay<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.max_commit_delay = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_max_commit_delay<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.max_commit_delay = v.map(|x| x.into());
self
}
pub fn set_request_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_request_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = v.map(|x| x.into());
self
}
pub fn set_precommit_token<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_precommit_token<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = v.map(|x| x.into());
self
}
pub fn set_routing_hint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_routing_hint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutingHint>,
{
self.routing_hint = v.map(|x| x.into());
self
}
pub fn set_transaction<
T: std::convert::Into<std::option::Option<crate::model::commit_request::Transaction>>,
>(
mut self,
v: T,
) -> Self {
self.transaction = v.into();
self
}
pub fn transaction_id(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.transaction.as_ref().and_then(|v| match v {
crate::model::commit_request::Transaction::TransactionId(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_transaction_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.transaction = std::option::Option::Some(
crate::model::commit_request::Transaction::TransactionId(v.into()),
);
self
}
pub fn single_use_transaction(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::TransactionOptions>> {
#[allow(unreachable_patterns)]
self.transaction.as_ref().and_then(|v| match v {
crate::model::commit_request::Transaction::SingleUseTransaction(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_single_use_transaction<
T: std::convert::Into<std::boxed::Box<crate::model::TransactionOptions>>,
>(
mut self,
v: T,
) -> Self {
self.transaction = std::option::Option::Some(
crate::model::commit_request::Transaction::SingleUseTransaction(v.into()),
);
self
}
}
impl wkt::message::Message for CommitRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.CommitRequest"
}
}
pub mod commit_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Transaction {
TransactionId(::bytes::Bytes),
SingleUseTransaction(std::boxed::Box<crate::model::TransactionOptions>),
}
impl Transaction {
pub fn from_transaction_id(value: impl std::convert::Into<::bytes::Bytes>) -> Self {
Self::TransactionId(value.into())
}
pub fn from_single_use_transaction(
value: impl std::convert::Into<std::boxed::Box<crate::model::TransactionOptions>>,
) -> Self {
Self::SingleUseTransaction(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RollbackRequest {
pub session: std::string::String,
pub transaction_id: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RollbackRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_transaction_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.transaction_id = v.into();
self
}
}
impl wkt::message::Message for RollbackRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.RollbackRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchWriteRequest {
pub session: std::string::String,
pub request_options: std::option::Option<crate::model::RequestOptions>,
pub mutation_groups: std::vec::Vec<crate::model::batch_write_request::MutationGroup>,
pub exclude_txn_from_change_streams: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchWriteRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
pub fn set_request_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_request_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RequestOptions>,
{
self.request_options = v.map(|x| x.into());
self
}
pub fn set_mutation_groups<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::batch_write_request::MutationGroup>,
{
use std::iter::Iterator;
self.mutation_groups = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_exclude_txn_from_change_streams<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.exclude_txn_from_change_streams = v.into();
self
}
}
impl wkt::message::Message for BatchWriteRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.BatchWriteRequest"
}
}
pub mod batch_write_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MutationGroup {
pub mutations: std::vec::Vec<crate::model::Mutation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MutationGroup {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_mutations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Mutation>,
{
use std::iter::Iterator;
self.mutations = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MutationGroup {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.BatchWriteRequest.MutationGroup"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchWriteResponse {
pub indexes: std::vec::Vec<i32>,
pub status: std::option::Option<google_cloud_rpc::model::Status>,
pub commit_timestamp: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchWriteResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_indexes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i32>,
{
use std::iter::Iterator;
self.indexes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.status = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.status = v.map(|x| x.into());
self
}
pub fn set_commit_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_commit_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.commit_timestamp = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BatchWriteResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.BatchWriteResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FetchCacheUpdateRequest {
pub database: std::string::String,
pub max_recipe_count: i32,
pub max_range_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FetchCacheUpdateRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.database = v.into();
self
}
pub fn set_max_recipe_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_recipe_count = v.into();
self
}
pub fn set_max_range_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_range_count = v.into();
self
}
}
impl wkt::message::Message for FetchCacheUpdateRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.FetchCacheUpdateRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransactionOptions {
pub exclude_txn_from_change_streams: bool,
pub isolation_level: crate::model::transaction_options::IsolationLevel,
pub mode: std::option::Option<crate::model::transaction_options::Mode>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TransactionOptions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_exclude_txn_from_change_streams<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.exclude_txn_from_change_streams = v.into();
self
}
pub fn set_isolation_level<
T: std::convert::Into<crate::model::transaction_options::IsolationLevel>,
>(
mut self,
v: T,
) -> Self {
self.isolation_level = v.into();
self
}
pub fn set_mode<
T: std::convert::Into<std::option::Option<crate::model::transaction_options::Mode>>,
>(
mut self,
v: T,
) -> Self {
self.mode = v.into();
self
}
pub fn read_write(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::transaction_options::ReadWrite>> {
#[allow(unreachable_patterns)]
self.mode.as_ref().and_then(|v| match v {
crate::model::transaction_options::Mode::ReadWrite(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_read_write<
T: std::convert::Into<std::boxed::Box<crate::model::transaction_options::ReadWrite>>,
>(
mut self,
v: T,
) -> Self {
self.mode =
std::option::Option::Some(crate::model::transaction_options::Mode::ReadWrite(v.into()));
self
}
pub fn partitioned_dml(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::transaction_options::PartitionedDml>>
{
#[allow(unreachable_patterns)]
self.mode.as_ref().and_then(|v| match v {
crate::model::transaction_options::Mode::PartitionedDml(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_partitioned_dml<
T: std::convert::Into<std::boxed::Box<crate::model::transaction_options::PartitionedDml>>,
>(
mut self,
v: T,
) -> Self {
self.mode = std::option::Option::Some(
crate::model::transaction_options::Mode::PartitionedDml(v.into()),
);
self
}
pub fn read_only(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::transaction_options::ReadOnly>> {
#[allow(unreachable_patterns)]
self.mode.as_ref().and_then(|v| match v {
crate::model::transaction_options::Mode::ReadOnly(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_read_only<
T: std::convert::Into<std::boxed::Box<crate::model::transaction_options::ReadOnly>>,
>(
mut self,
v: T,
) -> Self {
self.mode =
std::option::Option::Some(crate::model::transaction_options::Mode::ReadOnly(v.into()));
self
}
}
impl wkt::message::Message for TransactionOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.TransactionOptions"
}
}
pub mod transaction_options {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReadWrite {
pub read_lock_mode: crate::model::transaction_options::read_write::ReadLockMode,
pub multiplexed_session_previous_transaction_id: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ReadWrite {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_read_lock_mode<
T: std::convert::Into<crate::model::transaction_options::read_write::ReadLockMode>,
>(
mut self,
v: T,
) -> Self {
self.read_lock_mode = v.into();
self
}
pub fn set_multiplexed_session_previous_transaction_id<
T: std::convert::Into<::bytes::Bytes>,
>(
mut self,
v: T,
) -> Self {
self.multiplexed_session_previous_transaction_id = v.into();
self
}
}
impl wkt::message::Message for ReadWrite {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.TransactionOptions.ReadWrite"
}
}
pub mod read_write {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ReadLockMode {
Unspecified,
Pessimistic,
Optimistic,
UnknownValue(read_lock_mode::UnknownValue),
}
#[doc(hidden)]
pub mod read_lock_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ReadLockMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Pessimistic => std::option::Option::Some(1),
Self::Optimistic => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("READ_LOCK_MODE_UNSPECIFIED"),
Self::Pessimistic => std::option::Option::Some("PESSIMISTIC"),
Self::Optimistic => std::option::Option::Some("OPTIMISTIC"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ReadLockMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ReadLockMode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ReadLockMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Pessimistic,
2 => Self::Optimistic,
_ => Self::UnknownValue(read_lock_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ReadLockMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"READ_LOCK_MODE_UNSPECIFIED" => Self::Unspecified,
"PESSIMISTIC" => Self::Pessimistic,
"OPTIMISTIC" => Self::Optimistic,
_ => Self::UnknownValue(read_lock_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ReadLockMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Pessimistic => serializer.serialize_i32(1),
Self::Optimistic => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ReadLockMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReadLockMode>::new(
".google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionedDml {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionedDml {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for PartitionedDml {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.TransactionOptions.PartitionedDml"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReadOnly {
pub return_read_timestamp: bool,
pub timestamp_bound:
std::option::Option<crate::model::transaction_options::read_only::TimestampBound>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ReadOnly {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_return_read_timestamp<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.return_read_timestamp = v.into();
self
}
pub fn set_timestamp_bound<
T: std::convert::Into<
std::option::Option<
crate::model::transaction_options::read_only::TimestampBound,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.timestamp_bound = v.into();
self
}
pub fn strong(&self) -> std::option::Option<&bool> {
#[allow(unreachable_patterns)]
self.timestamp_bound.as_ref().and_then(|v| match v {
crate::model::transaction_options::read_only::TimestampBound::Strong(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_strong<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.timestamp_bound = std::option::Option::Some(
crate::model::transaction_options::read_only::TimestampBound::Strong(v.into()),
);
self
}
pub fn min_read_timestamp(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
#[allow(unreachable_patterns)]
self.timestamp_bound.as_ref().and_then(|v| match v {
crate::model::transaction_options::read_only::TimestampBound::MinReadTimestamp(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_min_read_timestamp<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.timestamp_bound = std::option::Option::Some(
crate::model::transaction_options::read_only::TimestampBound::MinReadTimestamp(
v.into(),
),
);
self
}
pub fn max_staleness(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
#[allow(unreachable_patterns)]
self.timestamp_bound.as_ref().and_then(|v| match v {
crate::model::transaction_options::read_only::TimestampBound::MaxStaleness(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_max_staleness<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
mut self,
v: T,
) -> Self {
self.timestamp_bound = std::option::Option::Some(
crate::model::transaction_options::read_only::TimestampBound::MaxStaleness(
v.into(),
),
);
self
}
pub fn read_timestamp(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
#[allow(unreachable_patterns)]
self.timestamp_bound.as_ref().and_then(|v| match v {
crate::model::transaction_options::read_only::TimestampBound::ReadTimestamp(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_read_timestamp<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.timestamp_bound = std::option::Option::Some(
crate::model::transaction_options::read_only::TimestampBound::ReadTimestamp(
v.into(),
),
);
self
}
pub fn exact_staleness(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
#[allow(unreachable_patterns)]
self.timestamp_bound.as_ref().and_then(|v| match v {
crate::model::transaction_options::read_only::TimestampBound::ExactStaleness(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_exact_staleness<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
mut self,
v: T,
) -> Self {
self.timestamp_bound = std::option::Option::Some(
crate::model::transaction_options::read_only::TimestampBound::ExactStaleness(
v.into(),
),
);
self
}
}
impl wkt::message::Message for ReadOnly {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.TransactionOptions.ReadOnly"
}
}
pub mod read_only {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TimestampBound {
Strong(bool),
MinReadTimestamp(std::boxed::Box<wkt::Timestamp>),
MaxStaleness(std::boxed::Box<wkt::Duration>),
ReadTimestamp(std::boxed::Box<wkt::Timestamp>),
ExactStaleness(std::boxed::Box<wkt::Duration>),
}
impl TimestampBound {
pub fn from_strong(value: impl std::convert::Into<bool>) -> Self {
Self::Strong(value.into())
}
pub fn from_min_read_timestamp(
value: impl std::convert::Into<std::boxed::Box<wkt::Timestamp>>,
) -> Self {
Self::MinReadTimestamp(value.into())
}
pub fn from_max_staleness(
value: impl std::convert::Into<std::boxed::Box<wkt::Duration>>,
) -> Self {
Self::MaxStaleness(value.into())
}
pub fn from_read_timestamp(
value: impl std::convert::Into<std::boxed::Box<wkt::Timestamp>>,
) -> Self {
Self::ReadTimestamp(value.into())
}
pub fn from_exact_staleness(
value: impl std::convert::Into<std::boxed::Box<wkt::Duration>>,
) -> Self {
Self::ExactStaleness(value.into())
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IsolationLevel {
Unspecified,
Serializable,
RepeatableRead,
UnknownValue(isolation_level::UnknownValue),
}
#[doc(hidden)]
pub mod isolation_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl IsolationLevel {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Serializable => std::option::Option::Some(1),
Self::RepeatableRead => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ISOLATION_LEVEL_UNSPECIFIED"),
Self::Serializable => std::option::Option::Some("SERIALIZABLE"),
Self::RepeatableRead => std::option::Option::Some("REPEATABLE_READ"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for IsolationLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for IsolationLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for IsolationLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Serializable,
2 => Self::RepeatableRead,
_ => Self::UnknownValue(isolation_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for IsolationLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ISOLATION_LEVEL_UNSPECIFIED" => Self::Unspecified,
"SERIALIZABLE" => Self::Serializable,
"REPEATABLE_READ" => Self::RepeatableRead,
_ => Self::UnknownValue(isolation_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for IsolationLevel {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Serializable => serializer.serialize_i32(1),
Self::RepeatableRead => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for IsolationLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IsolationLevel>::new(
".google.spanner.v1.TransactionOptions.IsolationLevel",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Mode {
ReadWrite(std::boxed::Box<crate::model::transaction_options::ReadWrite>),
PartitionedDml(std::boxed::Box<crate::model::transaction_options::PartitionedDml>),
ReadOnly(std::boxed::Box<crate::model::transaction_options::ReadOnly>),
}
impl Mode {
pub fn from_read_write(
value: impl std::convert::Into<
std::boxed::Box<crate::model::transaction_options::ReadWrite>,
>,
) -> Self {
Self::ReadWrite(value.into())
}
pub fn from_partitioned_dml(
value: impl std::convert::Into<
std::boxed::Box<crate::model::transaction_options::PartitionedDml>,
>,
) -> Self {
Self::PartitionedDml(value.into())
}
pub fn from_read_only(
value: impl std::convert::Into<std::boxed::Box<crate::model::transaction_options::ReadOnly>>,
) -> Self {
Self::ReadOnly(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Transaction {
pub id: ::bytes::Bytes,
pub read_timestamp: std::option::Option<wkt::Timestamp>,
pub precommit_token: std::option::Option<crate::model::MultiplexedSessionPrecommitToken>,
pub cache_update: std::option::Option<crate::model::CacheUpdate>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Transaction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_read_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.read_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_read_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.read_timestamp = v.map(|x| x.into());
self
}
pub fn set_precommit_token<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_precommit_token<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MultiplexedSessionPrecommitToken>,
{
self.precommit_token = v.map(|x| x.into());
self
}
pub fn set_cache_update<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cache_update<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CacheUpdate>,
{
self.cache_update = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Transaction {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Transaction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransactionSelector {
pub selector: std::option::Option<crate::model::transaction_selector::Selector>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TransactionSelector {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_selector<
T: std::convert::Into<std::option::Option<crate::model::transaction_selector::Selector>>,
>(
mut self,
v: T,
) -> Self {
self.selector = v.into();
self
}
pub fn single_use(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::TransactionOptions>> {
#[allow(unreachable_patterns)]
self.selector.as_ref().and_then(|v| match v {
crate::model::transaction_selector::Selector::SingleUse(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_single_use<
T: std::convert::Into<std::boxed::Box<crate::model::TransactionOptions>>,
>(
mut self,
v: T,
) -> Self {
self.selector = std::option::Option::Some(
crate::model::transaction_selector::Selector::SingleUse(v.into()),
);
self
}
pub fn id(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.selector.as_ref().and_then(|v| match v {
crate::model::transaction_selector::Selector::Id(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.selector =
std::option::Option::Some(crate::model::transaction_selector::Selector::Id(v.into()));
self
}
pub fn begin(&self) -> std::option::Option<&std::boxed::Box<crate::model::TransactionOptions>> {
#[allow(unreachable_patterns)]
self.selector.as_ref().and_then(|v| match v {
crate::model::transaction_selector::Selector::Begin(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_begin<T: std::convert::Into<std::boxed::Box<crate::model::TransactionOptions>>>(
mut self,
v: T,
) -> Self {
self.selector = std::option::Option::Some(
crate::model::transaction_selector::Selector::Begin(v.into()),
);
self
}
}
impl wkt::message::Message for TransactionSelector {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.TransactionSelector"
}
}
pub mod transaction_selector {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Selector {
SingleUse(std::boxed::Box<crate::model::TransactionOptions>),
Id(::bytes::Bytes),
Begin(std::boxed::Box<crate::model::TransactionOptions>),
}
impl Selector {
pub fn from_single_use(
value: impl std::convert::Into<std::boxed::Box<crate::model::TransactionOptions>>,
) -> Self {
Self::SingleUse(value.into())
}
pub fn from_id(value: impl std::convert::Into<::bytes::Bytes>) -> Self {
Self::Id(value.into())
}
pub fn from_begin(
value: impl std::convert::Into<std::boxed::Box<crate::model::TransactionOptions>>,
) -> Self {
Self::Begin(value.into())
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MultiplexedSessionPrecommitToken {
pub precommit_token: ::bytes::Bytes,
pub seq_num: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MultiplexedSessionPrecommitToken {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_precommit_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.precommit_token = v.into();
self
}
pub fn set_seq_num<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.seq_num = v.into();
self
}
}
impl wkt::message::Message for MultiplexedSessionPrecommitToken {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.MultiplexedSessionPrecommitToken"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Type {
pub code: crate::model::TypeCode,
pub array_element_type: std::option::Option<std::boxed::Box<crate::model::Type>>,
pub struct_type: std::option::Option<std::boxed::Box<crate::model::StructType>>,
pub type_annotation: crate::model::TypeAnnotationCode,
pub proto_type_fqn: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Type {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_code<T: std::convert::Into<crate::model::TypeCode>>(mut self, v: T) -> Self {
self.code = v.into();
self
}
pub fn set_array_element_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.array_element_type = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
pub fn set_or_clear_array_element_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.array_element_type = v.map(|x| std::boxed::Box::new(x.into()));
self
}
pub fn set_struct_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StructType>,
{
self.struct_type = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
pub fn set_or_clear_struct_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StructType>,
{
self.struct_type = v.map(|x| std::boxed::Box::new(x.into()));
self
}
pub fn set_type_annotation<T: std::convert::Into<crate::model::TypeAnnotationCode>>(
mut self,
v: T,
) -> Self {
self.type_annotation = v.into();
self
}
pub fn set_proto_type_fqn<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.proto_type_fqn = v.into();
self
}
}
impl wkt::message::Message for Type {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.Type"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StructType {
pub fields: std::vec::Vec<crate::model::struct_type::Field>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StructType {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::struct_type::Field>,
{
use std::iter::Iterator;
self.fields = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StructType {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.StructType"
}
}
pub mod struct_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Field {
pub name: std::string::String,
pub r#type: std::option::Option<std::boxed::Box<crate::model::Type>>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Field {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.r#type = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
pub fn set_or_clear_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Type>,
{
self.r#type = v.map(|x| std::boxed::Box::new(x.into()));
self
}
}
impl wkt::message::Message for Field {
fn typename() -> &'static str {
"type.googleapis.com/google.spanner.v1.StructType.Field"
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TypeCode {
Unspecified,
Bool,
Int64,
Float64,
Float32,
Timestamp,
Date,
String,
Bytes,
Array,
Struct,
Numeric,
Json,
Proto,
Enum,
Interval,
Uuid,
UnknownValue(type_code::UnknownValue),
}
#[doc(hidden)]
pub mod type_code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TypeCode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Bool => std::option::Option::Some(1),
Self::Int64 => std::option::Option::Some(2),
Self::Float64 => std::option::Option::Some(3),
Self::Float32 => std::option::Option::Some(15),
Self::Timestamp => std::option::Option::Some(4),
Self::Date => std::option::Option::Some(5),
Self::String => std::option::Option::Some(6),
Self::Bytes => std::option::Option::Some(7),
Self::Array => std::option::Option::Some(8),
Self::Struct => std::option::Option::Some(9),
Self::Numeric => std::option::Option::Some(10),
Self::Json => std::option::Option::Some(11),
Self::Proto => std::option::Option::Some(13),
Self::Enum => std::option::Option::Some(14),
Self::Interval => std::option::Option::Some(16),
Self::Uuid => std::option::Option::Some(17),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_CODE_UNSPECIFIED"),
Self::Bool => std::option::Option::Some("BOOL"),
Self::Int64 => std::option::Option::Some("INT64"),
Self::Float64 => std::option::Option::Some("FLOAT64"),
Self::Float32 => std::option::Option::Some("FLOAT32"),
Self::Timestamp => std::option::Option::Some("TIMESTAMP"),
Self::Date => std::option::Option::Some("DATE"),
Self::String => std::option::Option::Some("STRING"),
Self::Bytes => std::option::Option::Some("BYTES"),
Self::Array => std::option::Option::Some("ARRAY"),
Self::Struct => std::option::Option::Some("STRUCT"),
Self::Numeric => std::option::Option::Some("NUMERIC"),
Self::Json => std::option::Option::Some("JSON"),
Self::Proto => std::option::Option::Some("PROTO"),
Self::Enum => std::option::Option::Some("ENUM"),
Self::Interval => std::option::Option::Some("INTERVAL"),
Self::Uuid => std::option::Option::Some("UUID"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TypeCode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TypeCode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TypeCode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Bool,
2 => Self::Int64,
3 => Self::Float64,
4 => Self::Timestamp,
5 => Self::Date,
6 => Self::String,
7 => Self::Bytes,
8 => Self::Array,
9 => Self::Struct,
10 => Self::Numeric,
11 => Self::Json,
13 => Self::Proto,
14 => Self::Enum,
15 => Self::Float32,
16 => Self::Interval,
17 => Self::Uuid,
_ => Self::UnknownValue(type_code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TypeCode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_CODE_UNSPECIFIED" => Self::Unspecified,
"BOOL" => Self::Bool,
"INT64" => Self::Int64,
"FLOAT64" => Self::Float64,
"FLOAT32" => Self::Float32,
"TIMESTAMP" => Self::Timestamp,
"DATE" => Self::Date,
"STRING" => Self::String,
"BYTES" => Self::Bytes,
"ARRAY" => Self::Array,
"STRUCT" => Self::Struct,
"NUMERIC" => Self::Numeric,
"JSON" => Self::Json,
"PROTO" => Self::Proto,
"ENUM" => Self::Enum,
"INTERVAL" => Self::Interval,
"UUID" => Self::Uuid,
_ => Self::UnknownValue(type_code::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TypeCode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Bool => serializer.serialize_i32(1),
Self::Int64 => serializer.serialize_i32(2),
Self::Float64 => serializer.serialize_i32(3),
Self::Float32 => serializer.serialize_i32(15),
Self::Timestamp => serializer.serialize_i32(4),
Self::Date => serializer.serialize_i32(5),
Self::String => serializer.serialize_i32(6),
Self::Bytes => serializer.serialize_i32(7),
Self::Array => serializer.serialize_i32(8),
Self::Struct => serializer.serialize_i32(9),
Self::Numeric => serializer.serialize_i32(10),
Self::Json => serializer.serialize_i32(11),
Self::Proto => serializer.serialize_i32(13),
Self::Enum => serializer.serialize_i32(14),
Self::Interval => serializer.serialize_i32(16),
Self::Uuid => serializer.serialize_i32(17),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TypeCode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TypeCode>::new(
".google.spanner.v1.TypeCode",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TypeAnnotationCode {
Unspecified,
PgNumeric,
PgJsonb,
PgOid,
UnknownValue(type_annotation_code::UnknownValue),
}
#[doc(hidden)]
pub mod type_annotation_code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TypeAnnotationCode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::PgNumeric => std::option::Option::Some(2),
Self::PgJsonb => std::option::Option::Some(3),
Self::PgOid => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_ANNOTATION_CODE_UNSPECIFIED"),
Self::PgNumeric => std::option::Option::Some("PG_NUMERIC"),
Self::PgJsonb => std::option::Option::Some("PG_JSONB"),
Self::PgOid => std::option::Option::Some("PG_OID"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TypeAnnotationCode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TypeAnnotationCode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TypeAnnotationCode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::PgNumeric,
3 => Self::PgJsonb,
4 => Self::PgOid,
_ => Self::UnknownValue(type_annotation_code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TypeAnnotationCode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_ANNOTATION_CODE_UNSPECIFIED" => Self::Unspecified,
"PG_NUMERIC" => Self::PgNumeric,
"PG_JSONB" => Self::PgJsonb,
"PG_OID" => Self::PgOid,
_ => Self::UnknownValue(type_annotation_code::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TypeAnnotationCode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::PgNumeric => serializer.serialize_i32(2),
Self::PgJsonb => serializer.serialize_i32(3),
Self::PgOid => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TypeAnnotationCode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TypeAnnotationCode>::new(
".google.spanner.v1.TypeAnnotationCode",
))
}
}