macro_rules! mutation {
(@col $id:ident) => { ... };
(@col $lit:expr) => { ... };
(@build_write $builder:ident, $table:tt, { $($col:tt : $val:expr),* $(,)? }) => { ... };
(delete $table:expr, $key_set:expr) => { ... };
(insert $table:tt { $($rest:tt)* }) => { ... };
(update $table:tt { $($rest:tt)* }) => { ... };
(insert_or_update $table:tt { $($rest:tt)* }) => { ... };
(replace $table:tt { $($rest:tt)* }) => { ... };
}Expand description
Constructs a Mutation using declarative syntax.
ยงExamples
use google_cloud_spanner::key::KeySet;
use google_cloud_spanner::mutation;
// Insert operation
let insert_mut = mutation!(insert "Singers" {
SingerId: 1_i64,
FirstName: "Marc",
LastName: "Richards",
});
// Update operation
let update_mut = mutation!(update "Albums" {
SingerId: 1_i64,
AlbumId: 1_i64,
MarketingBudget: 100_000_i64,
});
// Insert or Update operation
let upsert_mut = mutation!(insert_or_update "Singers" {
SingerId: 1_i64,
FirstName: "Marc",
LastName: "Richards",
});
// Replace operation
let replace_mut = mutation!(replace "Singers" {
SingerId: 1_i64,
FirstName: "Marc",
LastName: "Richards",
});
// Delete operation
let delete_mut = mutation!(delete "Singers", KeySet::all());