- Implement a Lambda function that takes the movie category as input and returns a list of movies that corresponds to that category.
Answer:
func filter(category string)(events.APIGatewayProxyResponse, error) {
...
filter: = expression.Name("category").Equal(expression.Value(category))
projection: = expression.NamesList(expression.Name("id"), expression.Name("name"), expression.Name("description"))
expr, err: = expression.NewBuilder().WithFilter(filter).WithProjection(projection).Build()
if err != nil {
return events.APIGatewayProxyResponse {
StatusCode: http.StatusInternalServerError,
Body: "Error while building DynamoDB expression",
}, nil
}
svc: = dynamodb.New(cfg)
req: = svc.ScanRequest( & dynamodb.ScanInput {
TableName...