diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..b97d1bf --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,39 @@ +name: Go + +on: + - push + - pull_request + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Setup DynamoDB Local + uses: rrainn/dynamodb-action@v2.0.0 + with: + port: 18000 + cors: '*' + + - name: Set up Go 1.16 + uses: actions/setup-go@v1 + with: + go-version: ^1.16.6 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go get -v -t -d ./... + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v -cover ./... + env: + AWS_REGION: local diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index afdc1d6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -services: - - docker - -sudo: false -language: go - -go: - - 1.15.x - -before_script: - - go get golang.org/x/lint/golint - - docker pull amazon/dynamodb-local:latest - - docker run -d -p 18000:8000 amazon/dynamodb-local:latest - -script: - - go build ./... - - golint ./... - - AWS_REGION=local go test -v ./... - -after_script: - - F=$(go fmt ./...); if [ ! -z "$F" ]; then echo "Please gofmt for"$'\n'"$F"; exit 1; fi diff --git a/README.md b/README.md index 7bda168..5b7bbb6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # aws-go-dynamodb -[![GoDoc](http://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/nabeken/aws-go-dynamodb/table) -[![Build Status](https://img.shields.io/travis/nabeken/aws-go-dynamodb/master.svg)](https://travis-ci.org/nabeken/aws-go-dynamodb) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/nabeken/aws-go-dynamodb)](https://pkg.go.dev/github.com/nabeken/aws-go-dynamodb) +[![Go](https://github.com/nabeken/aws-go-dynamodb/actions/workflows/go.yml/badge.svg)](https://github.com/nabeken/aws-go-dynamodb/actions/workflows/go.yml) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nabeken/aws-go-dynamodb/blob/master/LICENSE) aws-go-dynamodb is a Amazon DynamoDB library built with [aws/aws-sdk-go](https://github.com/aws/aws-sdk-go). diff --git a/attributes/attributes.go b/attributes/attributes.go index faf3f4f..252bc18 100644 --- a/attributes/attributes.go +++ b/attributes/attributes.go @@ -29,3 +29,10 @@ func Number(v int64) *dynamodb.AttributeValue { N: &n, } } + +// Binary returns dynamodb.AttributeValue for Binary. +func Binary(b []byte) *dynamodb.AttributeValue { + return &dynamodb.AttributeValue{ + B: b, + } +}