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,
    }
}
preguntada hace un año232 visualizaciones
1 Respuesta
0

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

AWS
AWSdave
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas