Skip to content

Commit

Permalink
Use generic GetDynamodbData util
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilsson committed Apr 8, 2023
1 parent 5ab4f9c commit f1a620a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.19
require (
github.com/aws/aws-lambda-go v1.34.1
github.com/aws/aws-sdk-go-v2/config v1.18.19
github.com/jwilsson/go-bot-utils v1.13.1
github.com/jwilsson/go-bot-utils v1.14.1
github.com/slack-go/slack v0.11.3
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jwilsson/go-bot-utils v1.13.1 h1:VuCzp5IIx3Us0zZGyfRp9IKXuyZ79A1NcYBJjh1f++A=
github.com/jwilsson/go-bot-utils v1.13.1/go.mod h1:D8HwnB+CpO0Qt5+q4+MgvoDV+eSn62mDwF043nPJn/I=
github.com/jwilsson/go-bot-utils v1.14.1 h1:TMhnFTyfXaIn69sPHKfikdCRW4/L8pg7PITShY5gFaI=
github.com/jwilsson/go-bot-utils v1.14.1/go.mod h1:D8HwnB+CpO0Qt5+q4+MgvoDV+eSn62mDwF043nPJn/I=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rickar/cal/v2 v2.1.7 h1:2ePuyYfK828ei33IEOuqwDUVsup2wLNxwV+vQdfzrq8=
Expand Down
8 changes: 4 additions & 4 deletions image.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ type Image struct {
ImageURL string `json:"image_url" dynamodbav:"image_url"`
}

func getImages(ctx context.Context, tableName string) (images []Image, err error) {
func getImages(ctx context.Context, tableName string) ([]Image, error) {
cfg, err := config.LoadDefaultConfig(ctx)
if err != nil {
return images, err
return nil, err
}

err = utils.GetDynamodbData(ctx, cfg, tableName, &images)
images, err := utils.GetDynamodbData[Image](ctx, cfg, tableName)
if err != nil {
return images, err
return nil, err
}

sort.Slice(images, func(i int, j int) bool {
Expand Down

0 comments on commit f1a620a

Please sign in to comment.