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 IfNotExists(name NameBuilder, setValue OperandBuilder) SetValueBuilder

IfNotExists creates a SetValueBuilder to be used in as an argument to Set(). The first argument must be a NameBuilder representing the name where the new item attribute is created. The second argument can either be a NameBuilder or a ValueBuilder. In the case that it is a NameBuilder, the value of the item attribute at the name specified becomes the value of the new item attribute. More information:


// Use IfNotExists() to set item attribute "someName" to value 5 if // "someName" does not exist yet. (Prevents overwrite) update, err := expression.Set(expression.Name("someName"), expression.IfNotExists(expression.Name("someName"), expression.Value(5)))

Expression Equivalent:

expression.IfNotExists(expression.Name("someName"), expression.Value(5)) // let :five be a ExpressionAttributeValue representing the value 5 "if_not_exists (someName, :five)"


NameBuilder represents a name of a top level item attribute or a nested attribute. Since NameBuilder represents a DynamoDB Operand, it implements the OperandBuilder interface. Methods and functions in the package take NameBuilder as an argument and establishes relationships between operands. NameBuilder should only be initialized using the function Name().


// Create a NameBuilder representing the item attribute "aName" nameBuilder := expression.Name("aName")

OperandBuilder represents the idea of Operand 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. OperandBuilder and BuildOperand() are exported to allow package functions to take an interface as an argument.


SetValueBuilder represents the outcome of operator functions supported by the DynamoDB Set operation. The operator functions are the following:

Plus() // Represents the "+" operator Minus() // Represents the "-" operator ListAppend() IfNotExists()

For documentation on the above functions, see: Since SetValueBuilder represents an operand, it implements the OperandBuilder interface. SetValueBuilder structs are used as arguments to the Set() function. SetValueBuilders should only initialize a SetValueBuilder using the functions listed above.

On this page: