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

Make Generated Builders Vec-Aware #267

Merged
merged 9 commits into from
Apr 7, 2021
Merged

Make Generated Builders Vec-Aware #267

merged 9 commits into from
Apr 7, 2021

Conversation

rcoh
Copy link
Collaborator

@rcoh rcoh commented Mar 22, 2021

Builds towards #85

Description of changes:
This updates the generated builders & fluent client to be vec & hashmap aware. The builder method with the same name as the field will append the field to the list, creating it if it doesn't exist. A set_xyz method is added which retains the original behavior. A similar behavior is generated for methods containing HashMaps

Before:

    let mut expr_attrib_names = HashMap::new();
    expr_attrib_names.insert("#yr".to_string(), "year".to_string());
    let mut expr_attrib_values = HashMap::new();
    expr_attrib_values.insert(":yyyy".to_string(), AttributeValue::N(year.to_string()));
    client
        .query()
        .table_name(table_name)
        .key_condition_expression("#yr = :yyyy")
        .expression_attribute_names(expr_attrib_names)
        .expression_attribute_values(expr_attrib_values)

After:

    client
        .query()
        .table_name(table_name)
        .key_condition_expression("#yr = :yyyy")
        .expression_attribute_names("#yr", "year")
        .expression_attribute_values(":yyyy", AttributeValue::N(year.to_string()))

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This updates the generated builders & fluent client to be vec-aware. The builder method with the same name as the field will append the field to the list, creating it if it doesn't exist. A `set_xyz` method is added which retains the original behavior.
@rcoh rcoh requested a review from a team March 22, 2021 21:18
Copy link
Contributor

@aajtodd aajtodd left a comment

Choose a reason for hiding this comment

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

LGTM!

@rcoh rcoh merged commit cd21b6d into main Apr 7, 2021
@rcoh rcoh deleted the vec-builders branch April 7, 2021 14:34
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.

2 participants