pub enum Operation {
Insert(Write),
Update(Write),
InsertOrUpdate(Write),
Replace(Write),
Delete(Delete),
}
Expand description
Required. The operation to perform.
Variants§
Insert(Write)
Insert new rows in a table. If any of the rows already exist,
the write or transaction fails with error ALREADY_EXISTS
.
Update(Write)
Update existing rows in a table. If any of the rows does not
already exist, the transaction fails with error NOT_FOUND
.
InsertOrUpdate(Write)
Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then its column values are overwritten with the ones provided. Any column values not explicitly written are preserved.
When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all NOT NULL
columns in the table must be given a value. This holds true
even when the row already exists and will therefore actually be updated.
Replace(Write)
Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is
deleted, and the column values provided are inserted
instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not
explicitly written become NULL
.
In an interleaved table, if you create the child table with the
ON DELETE CASCADE
annotation, then replacing a parent row
also deletes the child rows. Otherwise, you must delete the
child rows before you replace the parent row.
Delete(Delete)
Delete rows from a table. Succeeds whether or not the named rows were present.
Implementations§
source§impl Operation
impl Operation
sourcepub fn merge(
field: &mut Option<Operation>,
tag: u32,
wire_type: WireType,
buf: &mut impl Buf,
ctx: DecodeContext,
) -> Result<(), DecodeError>
pub fn merge( field: &mut Option<Operation>, tag: u32, wire_type: WireType, buf: &mut impl Buf, ctx: DecodeContext, ) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into self.
sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Trait Implementations§
source§impl PartialEq for Operation
impl PartialEq for Operation
impl StructuralPartialEq for Operation
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnwindSafe for Operation
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request