KeySpec
Defines the specification for a partition or sort key, including the names and types of its attributes. Key specifications are an important component of item schemas since they describe how to interact with each key attribute and provide vital typing information for features which interact with DynamoDB operations like Query and Scan.
A KeySpec consisting of a single attribute may be created manually by invoking one the companion object methods byteArray, number, or string. A KeySpec consisting of more attributes may be created by invoking one of the extension methods thenInt, thenLong, thenString, etc. Key specifications may consist of up to four attributes.
Important: The order of attributes within a KeySpec is significant and must reflect the order of the attributes defined in the table or index key within DynamoDB.
Examples
To create a key specification for a single attribute:
val spec = KeySpec.int("companyId") // returns KeySpec.Key1<Int>To create a key specification for multiple attributes:
val spec = KeySpec
.int("companyId") // returns KeySpec.Key1<Int>
.thenString("department") // returns KeySpec.Key2<Int, String>
.thenLong("timestamp") // returns KeySpec.Key3<Int, String, Long>Type Parameters
The type of the key, either KeyType or one of its specific derivations
Inheritors
Properties
An ItemConverter instance which converts between K values and Item values