Module: Aws::Record::SecondaryIndexes::SecondaryIndexesClassMethods
- Included in:
- Aws::Record
- Defined in:
- lib/aws-record/record/secondary_indexes.rb
Instance Method Summary collapse
-
#global_secondary_index(name, opts) ⇒ Object
Creates a global secondary index for the model.
-
#global_secondary_indexes ⇒ Hash
Returns hash of global secondary index names to the index’s attributes.
-
#global_secondary_indexes_for_migration ⇒ Hash
Hash of the global secondary indexes in a form suitable for use in a table migration.
-
#local_secondary_index(name, opts) ⇒ Object
Creates a local secondary index for the model.
-
#local_secondary_indexes ⇒ Hash
Returns hash of local secondary index names to the index’s attributes.
-
#local_secondary_indexes_for_migration ⇒ Hash
Hash of the local secondary indexes in a form suitable for use in a table migration.
Instance Method Details
#global_secondary_index(name, opts) ⇒ Object
Creates a global secondary index for the model. Learn more about Global Secondary Indexes in the Amazon DynamoDB Developer Guide.
Note: #global_secondary_indexes is inherited from a parent model when global_secondary_index
is explicitly specified in the parent.
62 63 64 65 |
# File 'lib/aws-record/record/secondary_indexes.rb', line 62 def global_secondary_index(name, opts) _validate_required_gsi_keys(opts) global_secondary_indexes[name] = opts end |
#global_secondary_indexes ⇒ Hash
Returns hash of global secondary index names to the index’s attributes.
Note: global_secondary_indexes
is inherited from a parent model when #global_secondary_index is explicitly specified in the parent.
83 84 85 |
# File 'lib/aws-record/record/secondary_indexes.rb', line 83 def global_secondary_indexes @global_secondary_indexes end |
#global_secondary_indexes_for_migration ⇒ Hash
Returns hash of the global secondary indexes in a form suitable for use in a table migration. For example, any attributes which have a unique database storage name will use that name instead.
97 98 99 |
# File 'lib/aws-record/record/secondary_indexes.rb', line 97 def global_secondary_indexes_for_migration _migration_format_indexes(global_secondary_indexes) end |
#local_secondary_index(name, opts) ⇒ Object
Creates a local secondary index for the model. Learn more about Local Secondary Indexes in the Amazon DynamoDB Developer Guide.
Note: #local_secondary_indexes is inherited from a parent model when local_secondary_index
is explicitly specified in the parent.
41 42 43 44 45 |
# File 'lib/aws-record/record/secondary_indexes.rb', line 41 def local_secondary_index(name, opts) opts[:hash_key] = hash_key _validate_required_lsi_keys(opts) local_secondary_indexes[name] = opts end |
#local_secondary_indexes ⇒ Hash
Returns hash of local secondary index names to the index’s attributes.
Note: local_secondary_indexes
is inherited from a parent model when #local_secondary_index is explicitly specified in the parent.
73 74 75 |
# File 'lib/aws-record/record/secondary_indexes.rb', line 73 def local_secondary_indexes @local_secondary_indexes end |
#local_secondary_indexes_for_migration ⇒ Hash
Returns hash of the local secondary indexes in a form suitable for use in a table migration. For example, any attributes which have a unique database storage name will use that name instead.
90 91 92 |
# File 'lib/aws-record/record/secondary_indexes.rb', line 90 def local_secondary_indexes_for_migration _migration_format_indexes(local_secondary_indexes) end |