Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

Provide converters for AttributeValueUpdate #2

Open
behos opened this issue Jun 27, 2017 · 0 comments
Open

Provide converters for AttributeValueUpdate #2

behos opened this issue Jun 27, 2017 · 0 comments

Comments

@behos
Copy link
Owner

behos commented Jun 27, 2017

This will allow us to have stronly-typed updates

Not sure how we'd prefer to create it. We could offer an impl for each DynamoDBItem argument

#[derive(DynamoDBItem)]
struct MyItem {
    a: i32,
    b: String
}

impl MyItem {
    fn update_a(&self, operation: Option<AttributeAction>, value: i32) -> AttributeValueUpdate {
        ...
    }

    fn update_b(&self, operation: Option<AttributeAction>, value: String) -> AttributeValueUpdate {
        ...
    }
}

Alternatively we can return pairs of (String, AttributeValueUpdate) where String is the field name. We can then collect all of those updates into a HashMap to use for updates

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant