Rust SDK for Lambda - CRUD && trigger with DynamoDB

0

Playing around with Rust SDK and cargo lambda, to create a fn that reads new items appended to a specific table in DynamoDB, which is set as the trigger. I've written a fn as such. What are better approaches to this? I guess the more broader question would be - is there a quicker way to access enum variants that are passed as event to the handler fn?

fn matchAttribute<T>(attribute: &AttributeValue) -> Option<T> 
    where 
        bool:   Into<T>,
        f64:     Into<T>,
        String: Into<T>,
        T: for<'a> std::convert::From<&'a std::string::String>
{
    match attribute {
        AttributeValue::Boolean(b) => Some((*b).into()),
        AttributeValue::Number(f) => Some((*f).into()),
        AttributeValue::String(s) => Some((s).into()),
        _ => None,
    }
}
asked a year ago224 views
1 Answer
0

One option to consider is DDB Streams using Lambda event filtering: FIltering

AWS
AWSdave
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions