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,
    }
}
gefragt vor einem Jahr232 Aufrufe
1 Antwort
0

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

AWS
AWSdave
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen