Module: TinyDyno::HashKey

Extended by:
ActiveSupport::Concern
Included in:
DocumentComposition
Defined in:
lib/tiny_dyno/hash_key.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#hash_key_as_selectorObject

return all defined hash keys on an instantiated object for further use in DynamoDB queries, i.e. to look up an object



17
18
19
20
# File 'lib/tiny_dyno/hash_key.rb', line 17

def hash_key_as_selector
  key_field = self.class.primary_key[:attr]
  { "#{ self.class.primary_key[:attr] }": TinyDyno::Adapter.aws_attribute(field_type: fields[key_field].options[:type], value: attributes[key_field]) }
end