Reference documentation and code samples for the Firestore in Datastore mode API class Google::Cloud::Datastore::Commit.
Commit
Object yielded from commit
methods to allow multiple changes to be
made in a single commit.
See Dataset#commit and Transaction#commit.
Inherits
- Object
Example
require "google/cloud/datastore" datastore = Google::Cloud::Datastore.new datastore.commit do |c| c.save task3, task4 c.delete task1, task2 end
Methods
#delete
def delete(*entities_or_keys)
Remove entities from the Datastore.
require "google/cloud/datastore" datastore = Google::Cloud::Datastore.new datastore.commit do |c| c.delete task1, task2 end
#insert
def insert(*entities)
Inserts entities to the Datastore.
Parameter
Example
- entities (Entity) — One or more Entity objects to insert.
require "google/cloud/datastore" datastore = Google::Cloud::Datastore.new datastore.commit do |c| c.insert task1, task2 end
#save
def save(*entities)
Aliases
Saves entities to the Datastore.
Parameter
Example
- entities (Entity) — One or more Entity objects to save.
require "google/cloud/datastore" datastore = Google::Cloud::Datastore.new datastore.commit do |c| c.save task1, task2 end
#update
def update(*entities)
Updates entities to the Datastore.
Parameter
Example
- entities (Entity) — One or more Entity objects to update.
require "google/cloud/datastore" datastore = Google::Cloud::Datastore.new datastore.commit do |c| c.update task1, task2 end
#upsert
def upsert(*entities)
Alias Of: #save
Saves entities to the Datastore.
Parameter
Example
- entities (Entity) — One or more Entity objects to save.
require "google/cloud/datastore" datastore = Google::Cloud::Datastore.new datastore.commit do |c| c.save task1, task2 end