Class: AWSCDK::DynamoDB::SchemaOptions
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::DynamoDB::SchemaOptions
- Defined in:
- dynamo_db/schema_options.rb
Overview
Represents the table schema attributes.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#partition_key ⇒ AWSCDK::DynamoDB::Attribute?
readonly
Partition key attribute definition.
-
#sort_key ⇒ AWSCDK::DynamoDB::Attribute?
readonly
Sort key attribute definition.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(partition_key: nil, sort_key: nil) ⇒ SchemaOptions
constructor
A new instance of SchemaOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(partition_key: nil, sort_key: nil) ⇒ SchemaOptions
Returns a new instance of SchemaOptions.
9 10 11 12 13 14 |
# File 'dynamo_db/schema_options.rb', line 9 def initialize(partition_key: nil, sort_key: nil) @partition_key = partition_key.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**partition_key.transform_keys(&:to_sym)) : partition_key Jsii::Type.check_type(@partition_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQXR0cmlidXRlIn0=")), "partitionKey") unless @partition_key.nil? @sort_key = sort_key.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**sort_key.transform_keys(&:to_sym)) : sort_key Jsii::Type.check_type(@sort_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQXR0cmlidXRlIn0=")), "sortKey") unless @sort_key.nil? end |
Instance Attribute Details
#partition_key ⇒ AWSCDK::DynamoDB::Attribute? (readonly)
Note:
Default: - exactly one of partitionKey and partitionKeys must be specified.
Partition key attribute definition.
If a single field forms the partition key, you can use this field. Use the
partition_keys field if the partition key is a multi-attribute key (consists of
multiple fields).
24 25 26 |
# File 'dynamo_db/schema_options.rb', line 24 def partition_key @partition_key end |
#sort_key ⇒ AWSCDK::DynamoDB::Attribute? (readonly)
Note:
Default: - no sort key
Sort key attribute definition.
If a single field forms the sort key, you can use this field. Use the
sort_keys field if the sort key is a multi-attribute key (consists of multiple
fields).
33 34 35 |
# File 'dynamo_db/schema_options.rb', line 33 def sort_key @sort_key end |
Class Method Details
.jsii_properties ⇒ Object
35 36 37 38 39 40 |
# File 'dynamo_db/schema_options.rb', line 35 def self.jsii_properties { :partition_key => "partitionKey", :sort_key => "sortKey", } end |
Instance Method Details
#to_jsii ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'dynamo_db/schema_options.rb', line 42 def to_jsii result = {} result.merge!({ "partitionKey" => @partition_key, "sortKey" => @sort_key, }) result.compact end |