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 ""

func Key(key string) KeyBuilder

Key creates a KeyBuilder. The argument should represent the desired partition key or sort key value. KeyBuilders should only be used to specify relationships for Key Condition Expressions. When referring to the partition key or sort key in any other Expression, use Name().


// Use Key() to create a key condition expression keyCondition := expression.Key("foo").Equal(expression.Value("bar"))


Type: string


KeyBuilder represents either the partition key or the sort key, both of which are top level attributes to some item in DynamoDB. Since KeyBuilder represents an operand, KeyBuilder implements the OperandBuilder interface. Methods and functions in the package take KeyBuilder as an argument and establishes relationships between operands. However, KeyBuilder should only be used to describe Key Condition Expressions. KeyBuilder should only be initialized using the function Key().


// Create a KeyBuilder representing the item key "aKey" keyBuilder := expression.Key("aKey")

On this page: