Cloud Spanner API - Class Google::Cloud::Spanner::Rollback (v2.36.0)
Stay organized with collections
Save and categorize content based on your preferences.
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.
require"google/cloud/spanner"spanner=Google::Cloud::Spanner.newdb=spanner.client"my-instance","my-database"db.transactiondo|tx|tx.update"users",[{id:1,name:"Charlie",active:false}]tx.insert"users",[{id:2,name:"Harvey",active:true}]ifsomething_wrong?# Rollback the transaction without passing on the error# outside of the transaction method.raiseGoogle::Cloud::Spanner::Rollbackendend