Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(expressionBuilder): add ability to reference an attribute #143

Merged
merged 17 commits into from
Nov 12, 2022

Conversation

craPkit
Copy link
Contributor

@craPkit craPkit commented Mar 8, 2021

Implements #142

Supports referenced attributes on FilterExpressions' fields 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte'.

How To:

TestEntity.update({
  // ...
  conditions: { attr: 'a', eq: { attr: 'b' } }
});

Positive and negative tests included.

@darbio
Copy link
Contributor

darbio commented Mar 24, 2021

Can you add this to the README too?

@rbdmorgan
Copy link
Contributor

@craPkit this is a nice feature would be great to see it merged 😄

I added support for nested attribute conditions and filters in #288, #294 and #297 so you'll need to merge main and adapt this PR accordingly but shouldn't be too much work and the collective changes will complement each other nicely 🙏🏼

@craPkit
Copy link
Contributor Author

craPkit commented Jul 21, 2022

@craPkit this is a nice feature would be great to see it merged 😄

I added support for nested attribute conditions and filters in #288, #294 and #297 so you'll need to merge main and adapt this PR accordingly but shouldn't be too much work and the collective changes will complement each other nicely 🙏🏼

Main is merged now. I haven't implemented nested attributes in my AttrRefs though, since, being ignorant of your feature, I wasn't sure which cases need to be covered.

@naorpeled
Copy link
Collaborator

naorpeled commented Sep 25, 2022

Hey @craPkit ,
first of all, thanks for creating this PR, you're awesome!

Sorry for the late reply to this.
Will review this PR in a bit and will aim to merge this asap, this is a great addition to the library!

Copy link
Collaborator

@naorpeled naorpeled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good,
left one small nit comment.

Let's also add a validation and a test that begins_with is not used with an AttrRef because it's currently generating an invalid expression.

Once that's addressed, this PR will be ready to merge 😎

src/lib/expressionBuilder.ts Outdated Show resolved Hide resolved
@naorpeled naorpeled changed the title Add possibility to reference a secondary attribute in a condition clause feat(expressionBuilder): add ability to reference an attribute Nov 12, 2022
@naorpeled naorpeled merged commit 314e744 into dynamodb-toolbox:main Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot reference secondary attributes in condition clauses
4 participants