Module: Dynamodb::AttributeAssignment::ClassMethods
- Defined in:
- lib/dynamodb/attribute_assignment.rb
Instance Attribute Summary collapse
-
#attribute_definitions ⇒ Object
readonly
Returns the value of attribute attribute_definitions.
-
#global_indexes ⇒ Object
readonly
Returns the value of attribute global_indexes.
-
#hash_key ⇒ Object
readonly
Returns the value of attribute hash_key.
-
#indexes ⇒ Object
readonly
Returns the value of attribute indexes.
-
#key_schema ⇒ Object
readonly
Returns the value of attribute key_schema.
-
#local_indexes ⇒ Object
readonly
Returns the value of attribute local_indexes.
-
#range_key ⇒ Object
readonly
Returns the value of attribute range_key.
Instance Method Summary collapse
- #global_index(options) ⇒ Object
- #key(attr_name, attr_type, options) ⇒ Object
- #local_index(options) ⇒ Object
- #table_name(_table_name = nil) ⇒ Object
- #time_to_live(&block) ⇒ Object
Instance Attribute Details
#attribute_definitions ⇒ Object (readonly)
Returns the value of attribute attribute_definitions.
55 56 57 |
# File 'lib/dynamodb/attribute_assignment.rb', line 55 def attribute_definitions @attribute_definitions end |
#global_indexes ⇒ Object (readonly)
Returns the value of attribute global_indexes.
55 56 57 |
# File 'lib/dynamodb/attribute_assignment.rb', line 55 def global_indexes @global_indexes end |
#hash_key ⇒ Object (readonly)
Returns the value of attribute hash_key.
55 56 57 |
# File 'lib/dynamodb/attribute_assignment.rb', line 55 def hash_key @hash_key end |
#indexes ⇒ Object (readonly)
Returns the value of attribute indexes.
55 56 57 |
# File 'lib/dynamodb/attribute_assignment.rb', line 55 def indexes @indexes end |
#key_schema ⇒ Object (readonly)
Returns the value of attribute key_schema.
55 56 57 |
# File 'lib/dynamodb/attribute_assignment.rb', line 55 def key_schema @key_schema end |
#local_indexes ⇒ Object (readonly)
Returns the value of attribute local_indexes.
55 56 57 |
# File 'lib/dynamodb/attribute_assignment.rb', line 55 def local_indexes @local_indexes end |
#range_key ⇒ Object (readonly)
Returns the value of attribute range_key.
55 56 57 |
# File 'lib/dynamodb/attribute_assignment.rb', line 55 def range_key @range_key end |
Instance Method Details
#global_index(options) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/dynamodb/attribute_assignment.rb', line 89 def global_index() @indexes ||= [] @indexes << define_global_index() [:keys].keys.each do |_key| define_attribute( { name: [:keys][_key][:name], type: [:keys][_key][:type] } ) end end |
#key(attr_name, attr_type, options) ⇒ Object
72 73 74 75 76 |
# File 'lib/dynamodb/attribute_assignment.rb', line 72 def key(attr_name, attr_type, ) instance_variable_set("@#{[:key]}_key", attr_name.to_s) define_attribute({ name: attr_name, type: attr_type }) define_key_schema(attr_name, [:key]) end |
#local_index(options) ⇒ Object
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/dynamodb/attribute_assignment.rb', line 78 def local_index() @indexes ||= [] @indexes << define_local_index() define_attribute( { name: [:key][:name], type: [:key][:type] } ) end |
#table_name(_table_name = nil) ⇒ Object
58 59 60 61 62 |
# File 'lib/dynamodb/attribute_assignment.rb', line 58 def table_name(_table_name = nil) return (@_table_name || name.tableize) if _table_name.nil? @_table_name = _table_name.to_s end |
#time_to_live(&block) ⇒ Object
102 103 104 |
# File 'lib/dynamodb/attribute_assignment.rb', line 102 def time_to_live(&block) define_method :schedule_time_to_live, &block end |