AWS SDK for Go (PILOT)
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 https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

Expression

import "github.com/aws/aws-sdk-go/service/dynamodb/expression"

type Expression struct { }

Expression represents a collection of DynamoDB Expressions. The getter methods of the Expression struct retrieves the formatted DynamoDB Expressions, ExpressionAttributeNames, and ExpressionAttributeValues.

Example:

// keyCond represents the Key Condition Expression keyCond := expression.Key("someKey").Equal(expression.Value("someValue")) // proj represents the Projection Expression proj := expression.NamesList(expression.Name("aName"), expression.Name("anotherName"), expression.Name("oneOtherName")) // Add keyCond and proj to builder as a Key Condition and Projection // respectively builder := expression.NewBuilder().WithKeyCondition(keyCond).WithProjection(proj) expr := builder.Build() queryInput := dynamodb.QueryInput{ KeyConditionExpression: expr.KeyCondition(), ProjectionExpression: expr.Projection(), ExpressionAttributeNames: expr.Names(), ExpressionAttributeValues: expr.Values(), TableName: aws.String("SomeTable"), }

Method

Condition

func (e Expression) Condition() *string

Condition returns the *string corresponding to the Condition Expression of the argument Expression. This method is used to satisfy the members of DynamoDB input structs. If the Expression does not have a condition expression this method returns nil.

Example:

// let expression be an instance of Expression{} deleteInput := dynamodb.DeleteItemInput{ ConditionExpression: expression.Condition(), ExpressionAttributeNames: expression.Names(), ExpressionAttributeValues: expression.Values(), Key: map[string]*dynamodb.AttributeValue{ "PartitionKey": &dynamodb.AttributeValue{ S: aws.String("SomeKey"), }, }, TableName: aws.String("SomeTable"), }

Filter

func (e Expression) Filter() *string

Filter returns the *string corresponding to the Filter Expression of the argument Expression. This method is used to satisfy the members of DynamoDB input structs. If the Expression does not have a filter expression this method returns nil.

Example:

// let expression be an instance of Expression{} queryInput := dynamodb.QueryInput{ KeyConditionExpression: expression.KeyCondition(), FilterExpression: expression.Filter(), ExpressionAttributeNames: expression.Names(), ExpressionAttributeValues: expression.Values(), TableName: aws.String("SomeTable"), }

KeyCondition

func (e Expression) KeyCondition() *string

KeyCondition returns the *string corresponding to the Key Condition Expression of the argument Expression. This method is used to satisfy the members of DynamoDB input structs. If the argument Expression does not have a KeyConditionExpression, KeyCondition() returns nil.

Example:

// let expression be an instance of Expression{} queryInput := dynamodb.QueryInput{ KeyConditionExpression: expression.KeyCondition(), ProjectionExpression: expression.Projection(), ExpressionAttributeNames: expression.Names(), ExpressionAttributeValues: expression.Values(), TableName: aws.String("SomeTable"), }

Names

func (e Expression) Names() map[string]*string

Names returns the map[string]*string corresponding to the ExpressionAttributeNames of the argument Expression. This method is used to satisfy the members of DynamoDB input structs. If Expression does not use ExpressionAttributeNames, this method returns nil. The ExpressionAttributeNames and ExpressionAttributeValues member of the input struct must always be assigned when using the Expression struct since all item attribute names and values are aliased. That means that if the ExpressionAttributeNames and ExpressionAttributeValues member is not assigned with the corresponding Names() and Values() methods, the DynamoDB operation will run into a logic error.

Example:

// let expression be an instance of Expression{} queryInput := dynamodb.QueryInput{ KeyConditionExpression: expression.KeyCondition(), ProjectionExpression: expression.Projection(), ExpressionAttributeNames: expression.Names(), ExpressionAttributeValues: expression.Values(), TableName: aws.String("SomeTable"), }

Projection

func (e Expression) Projection() *string

Projection returns the *string corresponding to the Projection Expression of the argument Expression. This method is used to satisfy the members of DynamoDB input structs. If the Expression does not have a projection expression this method returns nil.

Example:

// let expression be an instance of Expression{} queryInput := dynamodb.QueryInput{ KeyConditionExpression: expression.KeyCondition(), ProjectionExpression: expression.Projection(), ExpressionAttributeNames: expression.Names(), ExpressionAttributeValues: expression.Values(), TableName: aws.String("SomeTable"), }

Update

func (e Expression) Update() *string

Update returns the *string corresponding to the Update Expression of the argument Expression. This method is used to satisfy the members of DynamoDB input structs. If the argument Expression does not have a UpdateExpression, Update() returns nil.

Example:

// let expression be an instance of Expression{} updateInput := dynamodb.UpdateInput{ Key: map[string]*dynamodb.AttributeValue{ "PartitionKey": { S: aws.String("someKey"), }, }, UpdateExpression: expression.Update(), ExpressionAttributeNames: expression.Names(), ExpressionAttributeValues: expression.Values(), TableName: aws.String("SomeTable"), }

Values

func (e Expression) Values() map[string]*dynamodb.AttributeValue

Values returns the map[string]*dynamodb.AttributeValue corresponding to the ExpressionAttributeValues of the argument Expression. This method is used to satisfy the members of DynamoDB input structs. If Expression does not use ExpressionAttributeValues, this method returns nil. The ExpressionAttributeNames and ExpressionAttributeValues member of the input struct must always be assigned when using the Expression struct since all item attribute names and values are aliased. That means that if the ExpressionAttributeNames and ExpressionAttributeValues member is not assigned with the corresponding Names() and Values() methods, the DynamoDB operation will run into a logic error.

Example:

// let expression be an instance of Expression{} queryInput := dynamodb.QueryInput{ KeyConditionExpression: expression.KeyCondition(), ProjectionExpression: expression.Projection(), ExpressionAttributeNames: expression.Names(), ExpressionAttributeValues: expression.Values(), TableName: aws.String("SomeTable"), }

On this page: