module Minidynamo::Model::Keys
Attributes
range_key[R]
read_capacity[W]
For all the fields with defaults
write_capacity[W]
For all the fields with defaults
Public Instance Methods
hash_key()
click to toggle source
# File lib/minidynamo/model/keys.rb, line 10 def hash_key @hash_key || {:id => :string} end
hash_key=(key)
click to toggle source
# File lib/minidynamo/model/keys.rb, line 14 def hash_key=(key) @hash_key = key hk = key.keys[0] finder_method_name = "find_by_#{hk}".to_sym unless finder_method_name == :find_by_id self.define_singleton_method finder_method_name do |x| find_by_id x end end type = key[hk] attribute_creator_method_name = "#{type.to_s}_attr".to_sym #puts "hk: CALLING #{attribute_creator_method_name} with #{hk}" send attribute_creator_method_name, hk end
hash_key_attribute_name()
click to toggle source
# File lib/minidynamo/model/keys.rb, line 38 def hash_key_attribute_name hash_key.keys[0] end
hash_key_type()
click to toggle source
# File lib/minidynamo/model/keys.rb, line 46 def hash_key_type dynamo_db_table.hash_key.type.to_s.chars.first.to_sym end
hash_range_table?()
click to toggle source
# File lib/minidynamo/model/keys.rb, line 50 def hash_range_table? ! range_key.nil? end
range_key=(key)
click to toggle source
# File lib/minidynamo/model/keys.rb, line 29 def range_key=(key) @range_key = key rk = key.keys[0] type = key[rk] attribute_creator_method_name = "#{type.to_s}_attr".to_sym #puts "rk: CALLING #{attribute_creator_method_name} with #{rk}" send attribute_creator_method_name, rk end
range_key_attribute_name()
click to toggle source
# File lib/minidynamo/model/keys.rb, line 42 def range_key_attribute_name range_key.keys[0] end