Class: Dyna::DSL::DynamoDB::Table::LocalSecondaryIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/dyna/dsl/table.rb

Direct Known Subclasses

GlobalSecondaryIndex

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLocalSecondaryIndex

Returns a new instance of LocalSecondaryIndex.



117
118
119
# File 'lib/dyna/dsl/table.rb', line 117

def initialize
  @result = Hashie::Mash.new
end

Instance Attribute Details

#resultObject

Returns the value of attribute result.



115
116
117
# File 'lib/dyna/dsl/table.rb', line 115

def result
  @result
end

Instance Method Details

#key_schema(hash:, range: nil) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/dyna/dsl/table.rb', line 121

def key_schema(hash:, range: nil)
  @result.key_schema = [{
    attribute_name: hash,
    key_type: 'HASH',
  }]

  if range
    @result.key_schema << {
      attribute_name: range,
      key_type: 'RANGE',
    }
  end
end

#projection(projection_type:, non_key_attributes: nil) ⇒ Object



135
136
137
138
139
140
# File 'lib/dyna/dsl/table.rb', line 135

def projection(projection_type:, non_key_attributes: nil)
  @result.projection = {
    projection_type: projection_type,
    non_key_attributes: non_key_attributes,
  }
end