14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/dynamo_record/query.rb', line 14
def where(condition = {})
attribute = condition.first.first.to_s
value = condition.first.second
key_conditions = {}
key_conditions[attribute] = { attribute_value_list: [value],
comparison_operator: 'EQ' }
index_name = "#{attribute}-index"
options = self.default_options
options.merge!(key_conditions: key_conditions, index_name: index_name)
response = self.client.query(options)
DynamoRecord::Collection.new(response, self)
end
|