Reference documentation and code samples for the Cloud Spanner API class Google::Cloud::Spanner::Rollback.
Rollback
Used to rollback a transaction without passing on the exception. See
Client#transaction.
Inherits
Google::Cloud::Error
Example
require "google/cloud/spanner"
spanner = Google::Cloud::Spanner.new
db = spanner.client "my-instance", "my-database"
db.transaction do |tx|
tx.update "users", [{ id: 1, name: "Charlie", active: false }]
tx.insert "users", [{ id: 2, name: "Harvey", active: true }]
if something_wrong?
# Rollback the transaction without passing on the error
# outside of the transaction method.
raise Google::Cloud::Spanner::Rollback
end
end
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-30 UTC."],[],[]]