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.

ValueBuilder

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

type ValueBuilder struct { }

ValueBuilder represents an item attribute value operand and implements the OperandBuilder interface. Methods and functions in the package take ValueBuilder as an argument and establishes relationships between operands. ValueBuilder should only be initialized using the function Value().

Example:

// Create a ValueBuilder representing the string "aValue" valueBuilder := expression.Value("aValue")

Method

Between

func (vb ValueBuilder) Between(lower, upper OperandBuilder) ConditionBuilder

Between returns a ConditionBuilder representing the result of the BETWEEN function in DynamoDB Condition Expressions. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the condition where the value 6 is between values // 5 and 10 condition := expression.Value(6).Between(expression.Value(5), expression.Value(10)) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value(6).Between(expression.Value(5), expression.Value(10)) // Let :six, :five and :ten be ExpressionAttributeValues representing the // values 6, 5, and 10 respectively ":six BETWEEN :five AND :ten"

BuildOperand

func (vb ValueBuilder) BuildOperand() (Operand, error)

BuildOperand creates an Operand struct which are building blocks to DynamoDB Expressions. Package methods and functions can establish relationships between operands, representing DynamoDB Expressions. The method BuildOperand() is called recursively when the Build() method on the type Builder is called. BuildOperand() should never be called externally. BuildOperand() aliases all strings to avoid stepping over DynamoDB's reserved words. More information on reserved words at https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html

Equal

func (vb ValueBuilder) Equal(right OperandBuilder) ConditionBuilder

Equal returns a ConditionBuilder representing the equality clause of the two argument OperandBuilders. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the equal clause of the item attribute "foo" and // the value 5 condition := expression.Value(5).Equal(expression.Name("foo")) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value(5).Equal(expression.Name("foo")) // Let :five be an ExpressionAttributeValue representing the value 5 ":five = foo"

GreaterThan

func (vb ValueBuilder) GreaterThan(right OperandBuilder) ConditionBuilder

GreaterThan returns a ConditionBuilder representing the greater than clause of the two argument OperandBuilders. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the greater than clause of the item attribute // "foo" and the value 5 condition := expression.Value(5).GreaterThan(expression.Name("foo")) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value(5).GreaterThan(expression.Name("foo")) // Let :five be an ExpressionAttributeValue representing the value 5 ":five > foo"

GreaterThanEqual

func (vb ValueBuilder) GreaterThanEqual(right OperandBuilder) ConditionBuilder

GreaterThanEqual returns a ConditionBuilder representing the greater than equal to clause of the two argument OperandBuilders. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the greater than equal to clause of the item // attribute "foo" and the value 5 condition := expression.Value(5).GreaterThanEqual(expression.Name("foo")) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value(5).GreaterThanEqual(expression.Name("foo")) // Let :five be an ExpressionAttributeValue representing the value 5 ":five >= foo"

In

func (vb ValueBuilder) In(right OperandBuilder, other ...OperandBuilder) ConditionBuilder

In returns a ConditionBuilder representing the result of the IN function TODO change this one in DynamoDB Condition Expressions. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the condition where the value "yellow" is checked // against the list of colors "red", "green", and "blue". condition := expression.Value("yellow").In(expression.Value("red"), expression.Value("green"), expression.Value("blue")) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value("yellow").In(expression.Value("red"), expression.Value("green"), expression.Value("blue")) // Let :yellow, :red, :green, :blue be ExpressionAttributeValues // representing the values "yellow", "red", "green", and "blue" // respectively ":yellow IN (:red, :green, :blue)"

LessThan

func (vb ValueBuilder) LessThan(right OperandBuilder) ConditionBuilder

LessThan returns a ConditionBuilder representing the less than clause of the two argument OperandBuilders. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the less than clause of the item attribute "foo" // and the value 5 condition := expression.Value(5).LessThan(expression.Name("foo")) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value(5).LessThan(expression.Name("foo")) // Let :five be an ExpressionAttributeValue representing the value 5 ":five < foo"

LessThanEqual

func (vb ValueBuilder) LessThanEqual(right OperandBuilder) ConditionBuilder

LessThanEqual returns a ConditionBuilder representing the less than equal to clause of the two argument OperandBuilders. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the less than equal to clause of the item // attribute "foo" and the value 5 condition := expression.Value(5).LessThanEqual(expression.Name("foo")) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value(5).LessThanEqual(expression.Name("foo")) // Let :five be an ExpressionAttributeValue representing the value 5 ":five <= foo"

ListAppend

func (vb ValueBuilder) ListAppend(rightOperand OperandBuilder) SetValueBuilder

ListAppend creates a SetValueBuilder to be used in as an argument to Set(). The arguments can either be NameBuilders or ValueBuilders. ListAppend() only supports DynamoDB List types, so the ValueBuilder must be a List and the NameBuilder must specify an item attribute of type List. More information: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.SET.UpdatingListElements

Example:

// Use ListAppend() to set item attribute "someName" to a string list // equal to {"a", "list", "some", "list"} update, err := expression.Set(expression.Name("someName"), expression.Value([]string{"a", "list"}).ListAppend(expression.Value([]string{"some", "list"})))

Expression Equivalent:

expression.Name([]string{"a", "list"}).ListAppend(expression.Value([]string{"some", "list"}) // let :list1 and :list2 be a ExpressionAttributeValue representing the // list {"a", "list"} and {"some", "list"} respectively "list_append (:list1, :list2)"

Minus

func (vb ValueBuilder) Minus(rightOperand OperandBuilder) SetValueBuilder

Minus creates a SetValueBuilder to be used in as an argument to Set(). The arguments can either be NameBuilders or ValueBuilders. Minus() only supports DynamoDB Number types, so the ValueBuilder must be a Number and the NameBuilder must specify an item attribute of type Number. More information: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.SET.IncrementAndDecrement

Example:

// Use Minus() to set the value of item attribute "someName" to 5 - 10 update, err := expression.Set(expression.Name("someName"), expression.Value(5).Minus(expression.Value(10)))

Expression Equivalent:

expression.Value(5).Minus(expression.Value(10)) // let :five and :ten be ExpressionAttributeValues for the values 5 and // 10 respectively. ":five - :ten"

NotEqual

func (vb ValueBuilder) NotEqual(right OperandBuilder) ConditionBuilder

NotEqual returns a ConditionBuilder representing the not equal clause of the two argument OperandBuilders. The resulting ConditionBuilder can be used as a part of other Condition Expressions or as an argument to the WithCondition() method for the Builder struct.

Example:

// condition represents the not equal clause of the item attribute "foo" // and the value 5 condition := expression.Value(5).NotEqual(expression.Name("foo")) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Value(5).NotEqual(expression.Name("foo")) // Let :five be an ExpressionAttributeValue representing the value 5 ":five <> foo"

Plus

func (vb ValueBuilder) Plus(rightOperand OperandBuilder) SetValueBuilder

Plus creates a SetValueBuilder to be used in as an argument to Set(). The arguments can either be NameBuilders or ValueBuilders. Plus() only supports DynamoDB Number types, so the ValueBuilder must be a Number and the NameBuilder must specify an item attribute of type Number. More information: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.SET.IncrementAndDecrement

Example:

// Use Plus() to set the value of the item attribute "someName" to 5 + 10 update, err := expression.Set(expression.Name("someName"), expression.Value(5).Plus(expression.Value(10)))

Expression Equivalent:

expression.Value(5).Plus(expression.Value(10)) // let :five and :ten be ExpressionAttributeValues representing the value // 5 and 10 respectively ":five + :ten"

On this page: