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.

ConditionBuilder

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

type ConditionBuilder struct { }

ConditionBuilder represents Condition Expressions and Filter Expressions in DynamoDB. ConditionBuilders are one of the building blocks of the Builder struct. Since Filter Expressions support all the same functions and formats as Condition Expressions, ConditionBuilders represents both types of Expressions. More Information at: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ConditionExpressions.html More Information on Filter Expressions: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html#Query.FilterExpression

Method

And

func (cb ConditionBuilder) And(right ConditionBuilder, other ...ConditionBuilder) ConditionBuilder

And returns a ConditionBuilder representing the logical AND clause of the argument ConditionBuilders. 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. Note that And() can take a variadic number of ConditionBuilders as arguments.

Example:

// condition represents the condition where the item attribute "Name" is // equal to value "Generic Name" AND the item attribute "Age" is less // than value 40 condition := expression.Name("Name").Equal(expression.Value("Generic Name")).And(expression.Name("Age").LessThan(expression.Value(40))) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Name("Name").Equal(expression.Value("Generic Name")).And(expression.Name("Age").LessThan(expression.Value(40))) // Let #NAME, :name, and :forty be ExpressionAttributeName and // ExpressionAttributeValues representing the item attribute "Name", the // value "Generic Name", and the value 40 "(#NAME = :name) AND (Age < :forty)"

Not

func (cb ConditionBuilder) Not() ConditionBuilder

Not returns a ConditionBuilder representing the logical NOT clause of the argument ConditionBuilder. 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 item attribute "Name" // does not begin with "test" condition := expression.Name("Name").BeginsWith("test").Not() // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Name("Name").BeginsWith("test").Not() // Let :prefix be an ExpressionAttributeValue representing the value // "test" "NOT (begins_with (:prefix))"

Or

func (cb ConditionBuilder) Or(right ConditionBuilder, other ...ConditionBuilder) ConditionBuilder

Or returns a ConditionBuilder representing the logical OR clause of the argument ConditionBuilders. 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. Note that Or() can take a variadic number of ConditionBuilders as arguments.

Example:

// condition represents the condition where the item attribute "Price" is // less than the value 100 OR the item attribute "Rating" is greater than // the value 8 condition := expression.Name("Price").Equal(expression.Value(100)).Or(expression.Name("Rating").LessThan(expression.Value(8))) // Used in another Condition Expression anotherCondition := expression.Not(condition) // Used to make an Builder builder := expression.NewBuilder().WithCondition(condition)

Expression Equivalent:

expression.Name("Price").Equal(expression.Value(100)).Or(expression.Name("Rating").LessThan(expression.Value(8))) // Let :price and :rating be ExpressionAttributeValues representing the // the value 100 and value 8 respectively "(Price < :price) OR (Rating > :rating)"

On this page: