26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/dynomite/query.rb', line 26
def where(attributes)
raise "attributes.size == 1 only supported for now" if attributes.size != 1
attr_name = attributes.keys.first
attr_value = attributes[attr_name]
name_key, value_key = "##{attr_name}_name", ":#{attr_name}_value"
params = {
expression_attribute_names: { name_key => attr_name },
expression_attribute_values: { value_key => attr_value },
key_condition_expression: "#{name_key} = #{value_key}",
}
self.class.new(@item, @params.merge(params))
end
|