func getServices(containerID string, svc *dynamodb.DynamoDB) ([]*Service, error) { context := Context{} params := &dynamodb.QueryInput{ TableName: aws.String("Services"), KeyConditions: map[string]*dynamodb.Condition{ "ContainerID": { ComparisonOperator: aws.String("EQ"), // Required AttributeValueList: []*dynamodb.AttributeValue{ { S: aws.String(containerID), }, }, }, }, } resp, err := svc.Query(params) if err != nil { return context, err } // loop through the items and convert back to struct for _, item := range resp.Items { service := Service{} dynamodbattribute.ConvertFromMap(item, &service) context = append(context, &service) } return context, err }