Stream notifications are delivered to the Lambda handler whenever data in the DynamoDB table is modified. Depending on the Stream settings, a StreamRecord may contain: - Keys: key attributes of the modified item - NewImage: the entire item, as it appears after it was modified - OldImage: the entire
()
| 14 | // - NewImage: the entire item, as it appears after it was modified |
| 15 | // - OldImage: the entire item, as it appeared before it was modified |
| 16 | func ExampleDynamoDBEvent() { |
| 17 | lambda.Start(func(ctx context.Context, e *events.DynamoDBEvent) { |
| 18 | for _, record := range e.Records { |
| 19 | fmt.Printf("Processing request data for event ID %s, type %s.\n", record.EventID, record.EventName) |
| 20 | |
| 21 | for name, value := range record.Change.NewImage { |
| 22 | if value.DataType() == events.DataTypeString { |
| 23 | fmt.Printf("Attribute name: %s, value: %s\n", name, value.String()) |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | }) |
| 28 | } |