Class: Dynomite::Item::Query::Params::Base
- Inherits:
-
Object
- Object
- Dynomite::Item::Query::Params::Base
- Extended by:
- Memoist
- Defined in:
- lib/dynomite/item/query/params/base.rb
Direct Known Subclasses
Constant Summary
Constants included from Types
Instance Method Summary collapse
- #expression_string(expression) ⇒ Object
-
#function_names ⇒ Object
To add function example: 1.
- #join_expressions ⇒ Object
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
Methods included from Types
Instance Method Details
#expression_string(expression) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/dynomite/item/query/params/base.rb', line 32 def expression_string(expression) if expression.is_a?(String) # Function filter expression is simple String expression else # Else expression is CompressionExpression object with extra info like .or? expression.build # build the string end end |
#function_names ⇒ Object
To add function example:
-
params/base.rb function_names
-
query/chain.rb: add method
-
params/function/begins_with.rb: filter_expression, attribute_names, attribute_values
11 12 13 |
# File 'lib/dynomite/item/query/params/base.rb', line 11 def function_names %w[attribute_exists attribute_type begins_with contains size_fn] end |
#join_expressions ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dynomite/item/query/params/base.rb', line 15 def join_expressions joined = '' @expressions.each do |expression| string = expression_string(expression) if joined.empty? # first pass joined << string else if !expression.is_a?(String) && expression.or? joined << " OR #{string}" else joined << " AND #{string}" end end end joined end |