Method: AWS::DynamoDB::BatchWrite#put
- Defined in:
- lib/aws/dynamo_db/batch_write.rb
#put(table, items) ⇒ nil
Adds one or more items to the batch write operation.
# adding one item at a time to the batch
batch = AWS::DynamoDB::BatchWrite.new
batch.put('table-name', :id => 'id1', :color => 'red')
batch.put('table-name', :id => 'id2', :color => 'blue')
batch.process!
# adding multiple items to a batch
batch = AWS::DynamoDB::BatchWrite.new
batch.put('table-name', [
{ :id => 'id1', :color => 'red' },
{ :id => 'id2', :color => 'blue' },
{ :id => 'id3', :color => 'green' },
])
batch.process!
51 52 53 54 |
# File 'lib/aws/dynamo_db/batch_write.rb', line 51 def put table, items write(table, :put => items.flatten) nil end |