API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see

We welcome your feedback on this new version of the documentation. Send your comments to


import ""

type KeySchemaElement struct { AttributeName *string `min:"1" type:"string" required:"true"` KeyType *string `type:"string" required:"true" enum:"KeyType"` }

Represents a single element of a key schema. A key schema specifies the attributes that make up the primary key of a table, or the key attributes of an index.

A KeySchemaElement represents exactly one attribute of the primary key. For example, a simple primary key would be represented by one KeySchemaElement (for the partition key). A composite primary key would require one KeySchemaElement for the partition key, and another KeySchemaElement for the sort key.

A KeySchemaElement must be a scalar, top-level attribute (not a nested attribute). The data type must be one of String, Number, or Binary. The attribute cannot be nested within a List or a Map.


Type: *string

The name of a key attribute.

AttributeName is a required field


Type: *string

The role that this key attribute will assume:

  • HASH - partition key

  • RANGE - sort key

The partition key of an item is also known as its hash attribute. The term "hash attribute" derives from DynamoDB' usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values.

The sort key of an item is also known as its range attribute. The term "range attribute" derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.

KeyType is a required field



func (s KeySchemaElement) GoString() string

GoString returns the string representation


func (s *KeySchemaElement) SetAttributeName(v string) *KeySchemaElement

SetAttributeName sets the AttributeName field's value.


func (s *KeySchemaElement) SetKeyType(v string) *KeySchemaElement

SetKeyType sets the KeyType field's value.


func (s KeySchemaElement) String() string

String returns the string representation


func (s *KeySchemaElement) Validate() error

Validate inspects the fields of the type to determine if they are valid.

On this page: