Class: Dynamoid::AdapterPlugin::AwsSdkV3::ExecuteStatement
- Inherits:
-
Object
- Object
- Dynamoid::AdapterPlugin::AwsSdkV3::ExecuteStatement
- Defined in:
- lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb
Overview
Excecute a PartiQL query
Documentation:
-
docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ExecuteStatement.html
-
docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#execute_statement-instance_method
NOTE: For reads result may be paginated. Only pagination with NextToken is implemented. Currently LastEvaluatedKey in response cannot be fed to ExecuteStatement to get the next page.
See also:
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(client, statement, parameters, options) ⇒ ExecuteStatement
constructor
A new instance of ExecuteStatement.
Constructor Details
#initialize(client, statement, parameters, options) ⇒ ExecuteStatement
Returns a new instance of ExecuteStatement.
23 24 25 26 27 28 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb', line 23 def initialize(client, statement, parameters, ) @client = client @statement = statement @parameters = parameters @options = .symbolize_keys.slice(:consistent_read) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
21 22 23 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb', line 21 def client @client end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb', line 21 def @options end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
21 22 23 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb', line 21 def parameters @parameters end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
21 22 23 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb', line 21 def statement @statement end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb', line 30 def call request = { statement: @statement, parameters: @parameters, consistent_read: @options[:consistent_read], } response = client.execute_statement(request) unless response.next_token return response_to_items(response) end Enumerator.new do |yielder| yielder.yield(response_to_items(response)) while response.next_token request[:next_token] = response.next_token response = client.execute_statement(request) yielder.yield(response_to_items(response)) end end end |