Skip to content

Add more helpers to DynamoDB Expression #4764

@akiesler

Description

@akiesler

Describe the feature

DynamoDB Expression currently only supports a simple use case of two expressions and only offers an instance method for and but not or. I propose adding both instance and static methods for both and and or operations that take in a varargs of Expressions to join together.

Use Case

When writing a complex query with multiple distinct Expressions this will make it easier to express the relational logic between the queries. This make it easier to ensure that the Expression is capturing the intended logic of the author.

expression1.and(expression2.or(expression3))
Expression.and(expression1, expression2, expression3)

Proposed Solution

I would propose adding these as net new implementation to avoid breaking any clients relying on specifics of existing implementations. The instance methods would be accept a varargs input that would be converted to a list including the target then passed to the static methods. The static method would be wrappers around a generic varargs join that can combine any number of expressions together. It would leverage the existing join logic to iterate through all of the expression and merge them into one Expression.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.21.42

JDK version used

openjdk version "1.8.0_392"

Operating System and version

macOS 13.6.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions