Class: DynamoidAdvancedWhere::Nodes::ExistsNode
- Defined in:
- lib/dynamoid_advanced_where/nodes/exists_node.rb
Instance Attribute Summary collapse
-
#field_node ⇒ Object
Returns the value of attribute field_node.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Attributes inherited from BaseNode
Instance Method Summary collapse
- #expression_attribute_names ⇒ Object
- #expression_attribute_values ⇒ Object
-
#initialize(field_node:) ⇒ ExistsNode
constructor
A new instance of ExistsNode.
- #to_expression ⇒ Object
Methods included from Concerns::SupportsLogicalOr
Methods included from Concerns::SupportsLogicalAnd
Methods included from Concerns::Negatable
Constructor Details
#initialize(field_node:) ⇒ ExistsNode
Returns a new instance of ExistsNode.
14 15 16 17 18 |
# File 'lib/dynamoid_advanced_where/nodes/exists_node.rb', line 14 def initialize(field_node:) self.field_node = field_node self.prefix = SecureRandom.hex freeze end |
Instance Attribute Details
#field_node ⇒ Object
Returns the value of attribute field_node.
12 13 14 |
# File 'lib/dynamoid_advanced_where/nodes/exists_node.rb', line 12 def field_node @field_node end |
#prefix ⇒ Object
Returns the value of attribute prefix.
12 13 14 |
# File 'lib/dynamoid_advanced_where/nodes/exists_node.rb', line 12 def prefix @prefix end |
Instance Method Details
#expression_attribute_names ⇒ Object
27 28 29 |
# File 'lib/dynamoid_advanced_where/nodes/exists_node.rb', line 27 def expression_attribute_names field_node.expression_attribute_names end |
#expression_attribute_values ⇒ Object
31 32 33 34 35 |
# File 'lib/dynamoid_advanced_where/nodes/exists_node.rb', line 31 def expression_attribute_values { ":#{prefix}" => nil, } end |
#to_expression ⇒ Object
20 21 22 23 24 25 |
# File 'lib/dynamoid_advanced_where/nodes/exists_node.rb', line 20 def to_expression "NOT( attribute_not_exists(#{field_node.to_expression}) or #{field_node.to_expression} = :#{prefix} )" end |