Open mikeparker opened 3 years ago
disclaimer: I work at Amazon but don't work for the Lambda team
Why not just use the structs from the main SDK?
I believe the answer to this one is: because we didn't want to take a dependency on the aws sdk. This massively reduces the sizes of your Lambda functions assuming you don't need the aws sdk for some other reason. I think that's probably unlikely so I would be in favor of a fork of this library that just used the aws sdk directly for struct definitions.
That said, there is nothing stopping you from NOT using the events defined in this package and instead define your own, eg:
import "github.com/aws/aws-sdk-go/service/sqs" // not sure if this is the 100% correct import.
type SQSEvent struct {
Records []sqs.Message
}
I believe that'll work and give you the interop you want.
Is your feature request related to a problem? Please describe. I'm writing a library to use across fargate containers and lambda to deal with SQS messages and there are some annoying inconsistencies in the duplicate structs which represent the same objects. Why not just use the structs from the main SDK?
For example, the SQS event in this library:
And the main AWS sdk has similar:
Even ignoring the top level inconsistencies, if I want to pass around the attributes map from an SQS message, the sdk uses
map[string]*string
where as this library usesmap[string]string
.. arg! So I have to have 2 nearly identical functions depending on if the sqs message came from the aws golang sdk or the lambda golang sdk.https://github.com/aws/aws-lambda-go/blob/master/events/sqs.go#L15 https://github.com/aws/aws-sdk-go/blob/main/service/sqs/api.go#L3688
Describe the solution you'd like Please either a) Use the same structs for both libraries b) At least use the same base types for the attributes map and similar.. largely agreeing when to use pointers..