Class: Dynamoid::Criteria::KeyFieldsDetector
- Inherits:
-
Object
- Object
- Dynamoid::Criteria::KeyFieldsDetector
- Defined in:
- lib/dynamoid/criteria/key_fields_detector.rb
Defined Under Namespace
Classes: Query
Instance Method Summary collapse
- #hash_key ⇒ Object
- #index_name ⇒ Object
-
#initialize(query, source, forced_index_name: nil) ⇒ KeyFieldsDetector
constructor
A new instance of KeyFieldsDetector.
- #key_present? ⇒ Boolean
- #non_key_present? ⇒ Boolean
- #range_key ⇒ Object
Constructor Details
#initialize(query, source, forced_index_name: nil) ⇒ KeyFieldsDetector
Returns a new instance of KeyFieldsDetector.
27 28 29 30 31 32 33 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 27 def initialize(query, source, forced_index_name: nil) @query = query @source = source @query = Query.new(query) @forced_index_name = forced_index_name @result = find_keys_in_query end |
Instance Method Details
#hash_key ⇒ Object
43 44 45 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 43 def hash_key @result && @result[:hash_key] end |
#index_name ⇒ Object
51 52 53 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 51 def index_name @result && @result[:index_name] end |
#key_present? ⇒ Boolean
39 40 41 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 39 def key_present? @result.present? && @query.contain_with_eq_operator?(hash_key) end |
#non_key_present? ⇒ Boolean
35 36 37 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 35 def non_key_present? !@query.contain_only?([hash_key, range_key].compact) end |
#range_key ⇒ Object
47 48 49 |
# File 'lib/dynamoid/criteria/key_fields_detector.rb', line 47 def range_key @result && @result[:range_key] end |