Class: Dynomite::Item::Query::Params::Function::AttributeType

Inherits:
Base
  • Object
show all
Defined in:
lib/dynomite/item/query/params/function/attribute_type.rb

Constant Summary

Constants included from Types

Types::TYPE_MAP

Instance Method Summary collapse

Methods inherited from Base

#build_attribute_names_with_dot_paths, #initialize

Methods included from Types

#type_map

Methods included from Helpers

#all_where_field_names, #all_where_fields, #disable_index_for_any_or?, #disable_index_for_consistent_read?, #disable_index_for_not?, #normalize_expression_path, #normalize_project_expression, #query, #scan_required?, #with_where_groups

Constructor Details

This class inherits a constructor from Dynomite::Item::Query::Params::Function::Base

Instance Method Details

#attribute_namesObject



14
15
16
17
# File 'lib/dynomite/item/query/params/function/attribute_type.rb', line 14

def attribute_names
  paths = @query[:attribute_type].map { |attribute_type| attribute_type[:path] }
  build_attribute_names_with_dot_paths(paths)
end

#attribute_valuesObject



19
20
21
22
23
24
25
26
27
# File 'lib/dynomite/item/query/params/function/attribute_type.rb', line 19

def attribute_values
  values = {}
  @query[:attribute_type].each do |attribute_type|
    type = attribute_type[:type]
    type = type_map(type)
    values[":#{type}"] = type
  end
  values
end

#filter_expressionObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/dynomite/item/query/params/function/attribute_type.rb', line 3

def filter_expression
  filter_expression = []
  @query[:attribute_type].each do |attribute_type|
    path, type = attribute_type[:path], attribute_type[:type]
    path = normalize_expression_path(path)
    type = type_map(type)
    filter_expression << "attribute_type(#{path}, :#{type})"
  end
  filter_expression
end