Coder Social home page Coder Social logo

unmarchal DynamodbEventRecord about aws-lambda-go HOT 6 CLOSED

aws avatar aws commented on June 15, 2024
unmarchal DynamodbEventRecord

from aws-lambda-go.

Comments (6)

morcmarc avatar morcmarc commented on June 15, 2024 5

Hi @cmello,

I think my question is still relevant: could we change the type of NewImage and OldImage (and Keys) to *dynamodb.AttributeValue from *event.DynamoDBAttributeValue? They are virtually the same thing. That way you could just use dynamodbattribute.Unmarshal and the rest of the methods plus you reduced ambiguity?

from aws-lambda-go.

morcmarc avatar morcmarc commented on June 15, 2024 2

I would like to know this as well. Namely, why do we have two representations of the "same" thing: dynamodb.AttributeValue vs event.DynamoDBAttributeValue. The dynamodb package provides methods for unmarshalling into a struct which is quite handy, however I can't do the same with this package. I cannot even use something like mapstructure, because Map() returns a map with metadata.

from aws-lambda-go.

cmello avatar cmello commented on June 15, 2024 1

Hi @moedeveloper ,

You can use your own struct instead of DynamoDBEvent and customize serialization using the standard β€œjson” key in the field tags. Please see https://golang.org/pkg/encoding/json/#Marshal .

Best regards!

from aws-lambda-go.

asuresh8 avatar asuresh8 commented on June 15, 2024

Yeah check out the example we have in our tests:

https://github.com/aws/aws-lambda-go/blob/master/events/dynamodb_test.go#L18

from aws-lambda-go.

moedeveloper avatar moedeveloper commented on June 15, 2024

i saw it, you unmarchal to dynamoDBEvent, i want to unmarchal for a specific struct or maybe an interface{}

from aws-lambda-go.

cmello avatar cmello commented on June 15, 2024

Hi @morcmarc,

Thank you for your comments! dynamodb.AttributeValue is very handy but aws-lambda-go does not require a dependency on aws-sdk-go at this time. Could you please open a separate issue for discussing the options? Thank you very much!

from aws-lambda-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.