The Go language and DynamoDB

Amazon has provided the Go language with powerful packages that we can utilize to build applications that can efficiently interact with DynamoDB. The main package can be found at https://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/ .

Before we start diving into the code, let's take a refresher on the DatabaseHandler interface we discussed in Chapter 2, Building Microservices Using Rest APIs. This interface represents the database handler layer of our microservices, which is where the database access code lives. In case of the events service, this interface supported  four methods. Here is what it looked like:

type DatabaseHandler interface {  AddEvent(Event) ([]byte, error) FindEvent([]byte) (Event, error) ...

Get Cloud Native programming with Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.