mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-08 22:30:41 +00:00
Update vendored deps, including AWS SDK, openpgp, ftp, ...
This commit is contained in:
+3449
-167
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -29,7 +29,7 @@
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To Amazon DynamoDB with the SDK use the New function to create
|
||||
// To contact Amazon DynamoDB with the SDK use the New function to create
|
||||
// a new service client. With that client you can make API requests to the service.
|
||||
// These clients are safe to use concurrently.
|
||||
//
|
||||
|
||||
+36
-8
@@ -202,7 +202,7 @@ func (d *Decoder) decodeBinary(b []byte, v reflect.Value) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if v.Kind() != reflect.Slice {
|
||||
if v.Kind() != reflect.Slice && v.Kind() != reflect.Array {
|
||||
return &UnmarshalTypeError{Value: "binary", Type: v.Type()}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ func (d *Decoder) decodeBinary(b []byte, v reflect.Value) error {
|
||||
switch v.Type().Elem().Kind() {
|
||||
case reflect.Uint8:
|
||||
// Fallback to reflection copy for type aliased of []byte type
|
||||
if v.IsNil() || v.Cap() < len(b) {
|
||||
if v.Kind() != reflect.Array && (v.IsNil() || v.Cap() < len(b)) {
|
||||
v.Set(reflect.MakeSlice(v.Type(), len(b), len(b)))
|
||||
} else if v.Len() != len(b) {
|
||||
v.SetLen(len(b))
|
||||
@@ -229,10 +229,17 @@ func (d *Decoder) decodeBinary(b []byte, v reflect.Value) error {
|
||||
v.Index(i).SetUint(uint64(b[i]))
|
||||
}
|
||||
default:
|
||||
if v.Kind() == reflect.Array && v.Type().Elem().Kind() == reflect.Uint8 {
|
||||
reflect.Copy(v, reflect.ValueOf(b))
|
||||
if v.Kind() == reflect.Array {
|
||||
switch v.Type().Elem().Kind() {
|
||||
case reflect.Uint8:
|
||||
reflect.Copy(v, reflect.ValueOf(b))
|
||||
default:
|
||||
return &UnmarshalTypeError{Value: "binary", Type: v.Type()}
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
return &UnmarshalTypeError{Value: "binary", Type: v.Type()}
|
||||
}
|
||||
|
||||
@@ -251,6 +258,8 @@ func (d *Decoder) decodeBool(b *bool, v reflect.Value) error {
|
||||
}
|
||||
|
||||
func (d *Decoder) decodeBinarySet(bs [][]byte, v reflect.Value) error {
|
||||
isArray := false
|
||||
|
||||
switch v.Kind() {
|
||||
case reflect.Slice:
|
||||
// Make room for the slice elements if needed
|
||||
@@ -260,6 +269,7 @@ func (d *Decoder) decodeBinarySet(bs [][]byte, v reflect.Value) error {
|
||||
}
|
||||
case reflect.Array:
|
||||
// Limited to capacity of existing array.
|
||||
isArray = true
|
||||
case reflect.Interface:
|
||||
set := make([][]byte, len(bs))
|
||||
for i, b := range bs {
|
||||
@@ -274,7 +284,9 @@ func (d *Decoder) decodeBinarySet(bs [][]byte, v reflect.Value) error {
|
||||
}
|
||||
|
||||
for i := 0; i < v.Cap() && i < len(bs); i++ {
|
||||
v.SetLen(i + 1)
|
||||
if !isArray {
|
||||
v.SetLen(i + 1)
|
||||
}
|
||||
u, elem := indirect(v.Index(i), false)
|
||||
if u != nil {
|
||||
return u.UnmarshalDynamoDBAttributeValue(&dynamodb.AttributeValue{BS: bs})
|
||||
@@ -363,6 +375,8 @@ func (d *Decoder) decodeNumberToInterface(n *string) (interface{}, error) {
|
||||
}
|
||||
|
||||
func (d *Decoder) decodeNumberSet(ns []*string, v reflect.Value) error {
|
||||
isArray := false
|
||||
|
||||
switch v.Kind() {
|
||||
case reflect.Slice:
|
||||
// Make room for the slice elements if needed
|
||||
@@ -372,6 +386,7 @@ func (d *Decoder) decodeNumberSet(ns []*string, v reflect.Value) error {
|
||||
}
|
||||
case reflect.Array:
|
||||
// Limited to capacity of existing array.
|
||||
isArray = true
|
||||
case reflect.Interface:
|
||||
if d.UseNumber {
|
||||
set := make([]Number, len(ns))
|
||||
@@ -396,7 +411,9 @@ func (d *Decoder) decodeNumberSet(ns []*string, v reflect.Value) error {
|
||||
}
|
||||
|
||||
for i := 0; i < v.Cap() && i < len(ns); i++ {
|
||||
v.SetLen(i + 1)
|
||||
if !isArray {
|
||||
v.SetLen(i + 1)
|
||||
}
|
||||
u, elem := indirect(v.Index(i), false)
|
||||
if u != nil {
|
||||
return u.UnmarshalDynamoDBAttributeValue(&dynamodb.AttributeValue{NS: ns})
|
||||
@@ -410,6 +427,8 @@ func (d *Decoder) decodeNumberSet(ns []*string, v reflect.Value) error {
|
||||
}
|
||||
|
||||
func (d *Decoder) decodeList(avList []*dynamodb.AttributeValue, v reflect.Value) error {
|
||||
isArray := false
|
||||
|
||||
switch v.Kind() {
|
||||
case reflect.Slice:
|
||||
// Make room for the slice elements if needed
|
||||
@@ -419,6 +438,7 @@ func (d *Decoder) decodeList(avList []*dynamodb.AttributeValue, v reflect.Value)
|
||||
}
|
||||
case reflect.Array:
|
||||
// Limited to capacity of existing array.
|
||||
isArray = true
|
||||
case reflect.Interface:
|
||||
s := make([]interface{}, len(avList))
|
||||
for i, av := range avList {
|
||||
@@ -434,7 +454,10 @@ func (d *Decoder) decodeList(avList []*dynamodb.AttributeValue, v reflect.Value)
|
||||
|
||||
// If v is not a slice, array
|
||||
for i := 0; i < v.Cap() && i < len(avList); i++ {
|
||||
v.SetLen(i + 1)
|
||||
if !isArray {
|
||||
v.SetLen(i + 1)
|
||||
}
|
||||
|
||||
if err := d.decode(avList[i], v.Index(i), tag{}); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -526,6 +549,8 @@ func (d *Decoder) decodeString(s *string, v reflect.Value, fieldTag tag) error {
|
||||
}
|
||||
|
||||
func (d *Decoder) decodeStringSet(ss []*string, v reflect.Value) error {
|
||||
isArray := false
|
||||
|
||||
switch v.Kind() {
|
||||
case reflect.Slice:
|
||||
// Make room for the slice elements if needed
|
||||
@@ -534,6 +559,7 @@ func (d *Decoder) decodeStringSet(ss []*string, v reflect.Value) error {
|
||||
}
|
||||
case reflect.Array:
|
||||
// Limited to capacity of existing array.
|
||||
isArray = true
|
||||
case reflect.Interface:
|
||||
set := make([]string, len(ss))
|
||||
for i, s := range ss {
|
||||
@@ -548,7 +574,9 @@ func (d *Decoder) decodeStringSet(ss []*string, v reflect.Value) error {
|
||||
}
|
||||
|
||||
for i := 0; i < v.Cap() && i < len(ss); i++ {
|
||||
v.SetLen(i + 1)
|
||||
if !isArray {
|
||||
v.SetLen(i + 1)
|
||||
}
|
||||
u, elem := indirect(v.Index(i), false)
|
||||
if u != nil {
|
||||
return u.UnmarshalDynamoDBAttributeValue(&dynamodb.AttributeValue{SS: ss})
|
||||
|
||||
Generated
Vendored
+68
-27
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/service/dynamodb"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestUnmarshalErrorTypes(t *testing.T) {
|
||||
@@ -390,12 +389,22 @@ func TestUnmarshalUnmashaler(t *testing.T) {
|
||||
}
|
||||
|
||||
err := Unmarshal(av, u)
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
|
||||
assert.Equal(t, "value", u.Value)
|
||||
assert.Equal(t, 123, u.Value2)
|
||||
assert.Equal(t, true, u.Value3)
|
||||
assert.Equal(t, testDate, u.Value4)
|
||||
if e, a := "value", u.Value; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 123, u.Value2; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := true, u.Value3; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := testDate, u.Value4; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeUseNumber(t *testing.T) {
|
||||
@@ -412,13 +421,20 @@ func TestDecodeUseNumber(t *testing.T) {
|
||||
d.UseNumber = true
|
||||
})
|
||||
err := decoder.Decode(av, &u)
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
|
||||
assert.Equal(t, "value", u["abc"])
|
||||
n, ok := u["def"].(Number)
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, "123", n.String())
|
||||
assert.Equal(t, true, u["ghi"])
|
||||
if e, a := "value", u["abc"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
n := u["def"].(Number)
|
||||
if e, a := "123", n.String(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := true, u["ghi"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeUseNumberNumberSet(t *testing.T) {
|
||||
@@ -437,13 +453,18 @@ func TestDecodeUseNumberNumberSet(t *testing.T) {
|
||||
d.UseNumber = true
|
||||
})
|
||||
err := decoder.Decode(av, &u)
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
|
||||
ns, ok := u["ns"].([]Number)
|
||||
assert.True(t, ok)
|
||||
ns := u["ns"].([]Number)
|
||||
|
||||
assert.Equal(t, "123", ns[0].String())
|
||||
assert.Equal(t, "321", ns[1].String())
|
||||
if e, a := "123", ns[0].String(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "321", ns[1].String(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeEmbeddedPointerStruct(t *testing.T) {
|
||||
@@ -471,12 +492,20 @@ func TestDecodeEmbeddedPointerStruct(t *testing.T) {
|
||||
decoder := NewDecoder()
|
||||
a := A{}
|
||||
err := decoder.Decode(av, &a)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 321, a.Aint)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
if e, a := 321, a.Aint; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
// Embedded pointer struct can be created automatically.
|
||||
assert.Equal(t, 123, a.Bint)
|
||||
if e, a := 123, a.Bint; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
// But not for absent fields.
|
||||
assert.Nil(t, a.C)
|
||||
if a.C != nil {
|
||||
t.Errorf("expect nil, got %v", a.C)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeBooleanOverlay(t *testing.T) {
|
||||
@@ -491,8 +520,12 @@ func TestDecodeBooleanOverlay(t *testing.T) {
|
||||
var v BooleanOverlay
|
||||
|
||||
err := decoder.Decode(av, &v)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, BooleanOverlay(true), v)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
if e, a := BooleanOverlay(true), v; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeUnixTime(t *testing.T) {
|
||||
@@ -524,8 +557,12 @@ func TestDecodeUnixTime(t *testing.T) {
|
||||
actual := A{}
|
||||
|
||||
err := Unmarshal(input, &actual)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expect, actual)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
if e, a := expect, actual; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeAliasedUnixTime(t *testing.T) {
|
||||
@@ -552,6 +589,10 @@ func TestDecodeAliasedUnixTime(t *testing.T) {
|
||||
actual := A{}
|
||||
|
||||
err := Unmarshal(input, &actual)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expect, actual)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
if expect != actual {
|
||||
t.Errorf("expect %v, got %v", expect, actual)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -362,7 +362,10 @@ func (e *Encoder) encodeMap(av *dynamodb.AttributeValue, v reflect.Value, fieldT
|
||||
func (e *Encoder) encodeSlice(av *dynamodb.AttributeValue, v reflect.Value, fieldTag tag) error {
|
||||
switch v.Type().Elem().Kind() {
|
||||
case reflect.Uint8:
|
||||
b := v.Bytes()
|
||||
slice := reflect.MakeSlice(byteSliceType, v.Len(), v.Len())
|
||||
reflect.Copy(slice, v)
|
||||
|
||||
b := slice.Bytes()
|
||||
if len(b) == 0 {
|
||||
encodeNull(av)
|
||||
return nil
|
||||
|
||||
Generated
Vendored
+52
-18
@@ -2,13 +2,13 @@ package dynamodbattribute
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/service/dynamodb"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMarshalErrorTypes(t *testing.T) {
|
||||
@@ -73,9 +73,13 @@ func TestMarshalMashaler(t *testing.T) {
|
||||
}
|
||||
|
||||
actual, err := Marshal(m)
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("expect nil, got %v", err)
|
||||
}
|
||||
|
||||
assert.Equal(t, expect, actual)
|
||||
if e, a := expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
type testOmitEmptyElemListStruct struct {
|
||||
@@ -99,8 +103,12 @@ func TestMarshalListOmitEmptyElem(t *testing.T) {
|
||||
m := testOmitEmptyElemListStruct{Values: []string{"abc", "", "123"}}
|
||||
|
||||
actual, err := Marshal(m)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expect, actual)
|
||||
if err != nil {
|
||||
t.Errorf("expect nil, got %v", err)
|
||||
}
|
||||
if e, a := expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalMapOmitEmptyElem(t *testing.T) {
|
||||
@@ -121,8 +129,12 @@ func TestMarshalMapOmitEmptyElem(t *testing.T) {
|
||||
}}
|
||||
|
||||
actual, err := Marshal(m)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expect, actual)
|
||||
if err != nil {
|
||||
t.Errorf("expect nil, got %v", err)
|
||||
}
|
||||
if e, a := expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
type testOmitEmptyScalar struct {
|
||||
@@ -141,8 +153,12 @@ func TestMarshalOmitEmpty(t *testing.T) {
|
||||
m := testOmitEmptyScalar{IntPtrSetZero: aws.Int(0)}
|
||||
|
||||
actual, err := Marshal(m)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expect, actual)
|
||||
if err != nil {
|
||||
t.Errorf("expect nil, got %v", err)
|
||||
}
|
||||
if e, a := expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncodeEmbeddedPointerStruct(t *testing.T) {
|
||||
@@ -158,12 +174,20 @@ func TestEncodeEmbeddedPointerStruct(t *testing.T) {
|
||||
*C
|
||||
}
|
||||
a := A{Aint: 321, B: &B{123}}
|
||||
assert.Equal(t, 321, a.Aint)
|
||||
assert.Equal(t, 123, a.Bint)
|
||||
assert.Nil(t, a.C)
|
||||
if e, a := 321, a.Aint; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 123, a.Bint; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if a.C != nil {
|
||||
t.Errorf("expect nil, got %v", a.C)
|
||||
}
|
||||
|
||||
actual, err := Marshal(a)
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("expect nil, got %v", err)
|
||||
}
|
||||
expect := &dynamodb.AttributeValue{
|
||||
M: map[string]*dynamodb.AttributeValue{
|
||||
"Aint": {
|
||||
@@ -174,7 +198,9 @@ func TestEncodeEmbeddedPointerStruct(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expect, actual)
|
||||
if e, a := expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncodeUnixTime(t *testing.T) {
|
||||
@@ -191,7 +217,9 @@ func TestEncodeUnixTime(t *testing.T) {
|
||||
}
|
||||
|
||||
actual, err := Marshal(a)
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("expect nil, got %v", err)
|
||||
}
|
||||
expect := &dynamodb.AttributeValue{
|
||||
M: map[string]*dynamodb.AttributeValue{
|
||||
"Normal": {
|
||||
@@ -205,7 +233,9 @@ func TestEncodeUnixTime(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expect, actual)
|
||||
if e, a := expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
type AliasedTime time.Time
|
||||
@@ -222,7 +252,9 @@ func TestEncodeAliasedUnixTime(t *testing.T) {
|
||||
}
|
||||
|
||||
actual, err := Marshal(a)
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("expect no err, got %v", err)
|
||||
}
|
||||
expect := &dynamodb.AttributeValue{
|
||||
M: map[string]*dynamodb.AttributeValue{
|
||||
"Normal": {
|
||||
@@ -233,5 +265,7 @@ func TestEncodeAliasedUnixTime(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expect, actual)
|
||||
if e, a := expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
Generated
Vendored
+12
-6
@@ -3,8 +3,6 @@ package dynamodbattribute
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type testUnionValues struct {
|
||||
@@ -77,9 +75,13 @@ func TestUnionStructFields(t *testing.T) {
|
||||
fields := unionStructFields(v.Type(), MarshalOptions{SupportJSONTags: true})
|
||||
for j, f := range fields {
|
||||
expected := c.expect[j]
|
||||
assert.Equal(t, expected.Name, f.Name, "case %d, field %d", i, j)
|
||||
if e, a := expected.Name, f.Name; e != a {
|
||||
t.Errorf("%d:%d expect %v, got %v", i, j, e, f)
|
||||
}
|
||||
actual := v.FieldByIndex(f.Index).Interface()
|
||||
assert.EqualValues(t, expected.Value, actual, "case %d, field %d", i, j)
|
||||
if e, a := expected.Value, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d:%d expect %v, got %v", i, j, e, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,9 +104,13 @@ func TestFieldByName(t *testing.T) {
|
||||
|
||||
for _, c := range cases {
|
||||
f, ok := fieldByName(fields, c.Name)
|
||||
assert.Equal(t, c.Found, ok)
|
||||
if e, a := c.Found, ok; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if ok {
|
||||
assert.Equal(t, c.FieldName, f.Name)
|
||||
if e, a := c.FieldName, f.Name; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
Vendored
+47
@@ -493,6 +493,53 @@ func Test_New_UnmarshalListError(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// see github issue #1594
|
||||
func TestDecodeArrayType(t *testing.T) {
|
||||
cases := []struct {
|
||||
to, from interface{}
|
||||
}{
|
||||
{
|
||||
&[2]int{1, 2},
|
||||
&[2]int{},
|
||||
},
|
||||
{
|
||||
&[2]int64{1, 2},
|
||||
&[2]int64{},
|
||||
},
|
||||
{
|
||||
&[2]byte{1, 2},
|
||||
&[2]byte{},
|
||||
},
|
||||
{
|
||||
&[2]bool{true, false},
|
||||
&[2]bool{},
|
||||
},
|
||||
{
|
||||
&[2]string{"1", "2"},
|
||||
&[2]string{},
|
||||
},
|
||||
{
|
||||
&[2][]string{{"1", "2"}},
|
||||
&[2][]string{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
marshaled, err := Marshal(c.to)
|
||||
if err != nil {
|
||||
t.Errorf("expected no error, but received %v", err)
|
||||
}
|
||||
|
||||
if err = Unmarshal(marshaled, c.from); err != nil {
|
||||
t.Errorf("expected no error, but received %v", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(c.to, c.from) {
|
||||
t.Errorf("expected %v, but received %v", c.to, c.from)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func compareObjects(t *testing.T, expected interface{}, actual interface{}) {
|
||||
if !reflect.DeepEqual(expected, actual) {
|
||||
ev := reflect.ValueOf(expected)
|
||||
|
||||
Generated
Vendored
+8
-5
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/dynamodb"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type testBinarySetStruct struct {
|
||||
@@ -376,14 +375,18 @@ func assertConvertTest(t *testing.T, i int, actual, expected interface{}, err, e
|
||||
i++
|
||||
if expectedErr != nil {
|
||||
if err != nil {
|
||||
assert.Equal(t, expectedErr, err, "case %d", i)
|
||||
if e, a := expectedErr, err; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("case %d expect %v, got %v", i, e, a)
|
||||
}
|
||||
} else {
|
||||
assert.Fail(t, "", "case %d, expected error, %v", i)
|
||||
t.Fatalf("case %d, expected error, %v", i, expectedErr)
|
||||
}
|
||||
} else if err != nil {
|
||||
assert.Fail(t, "", "case %d, expect no error, got %v", i, err)
|
||||
t.Fatalf("case %d, expect no error, got %v", i, err)
|
||||
} else {
|
||||
assert.Equal(t, ptrToValue(expected), ptrToValue(actual), "case %d", i)
|
||||
if e, a := ptrToValue(expected), ptrToValue(actual); !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("case %d, expect %v, got %v", i, e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -3,8 +3,6 @@ package dynamodbattribute
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTagParse(t *testing.T) {
|
||||
@@ -42,6 +40,8 @@ func TestTagParse(t *testing.T) {
|
||||
if c.av {
|
||||
actual.parseAVTag(c.in)
|
||||
}
|
||||
assert.Equal(t, c.expect, actual, "case %d", i+1)
|
||||
if e, a := c.expect, actual; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("case %d, expect %v, got %v", i, e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+48
@@ -71,10 +71,22 @@ type DynamoDBAPI interface {
|
||||
BatchWriteItemWithContext(aws.Context, *dynamodb.BatchWriteItemInput, ...request.Option) (*dynamodb.BatchWriteItemOutput, error)
|
||||
BatchWriteItemRequest(*dynamodb.BatchWriteItemInput) (*request.Request, *dynamodb.BatchWriteItemOutput)
|
||||
|
||||
CreateBackup(*dynamodb.CreateBackupInput) (*dynamodb.CreateBackupOutput, error)
|
||||
CreateBackupWithContext(aws.Context, *dynamodb.CreateBackupInput, ...request.Option) (*dynamodb.CreateBackupOutput, error)
|
||||
CreateBackupRequest(*dynamodb.CreateBackupInput) (*request.Request, *dynamodb.CreateBackupOutput)
|
||||
|
||||
CreateGlobalTable(*dynamodb.CreateGlobalTableInput) (*dynamodb.CreateGlobalTableOutput, error)
|
||||
CreateGlobalTableWithContext(aws.Context, *dynamodb.CreateGlobalTableInput, ...request.Option) (*dynamodb.CreateGlobalTableOutput, error)
|
||||
CreateGlobalTableRequest(*dynamodb.CreateGlobalTableInput) (*request.Request, *dynamodb.CreateGlobalTableOutput)
|
||||
|
||||
CreateTable(*dynamodb.CreateTableInput) (*dynamodb.CreateTableOutput, error)
|
||||
CreateTableWithContext(aws.Context, *dynamodb.CreateTableInput, ...request.Option) (*dynamodb.CreateTableOutput, error)
|
||||
CreateTableRequest(*dynamodb.CreateTableInput) (*request.Request, *dynamodb.CreateTableOutput)
|
||||
|
||||
DeleteBackup(*dynamodb.DeleteBackupInput) (*dynamodb.DeleteBackupOutput, error)
|
||||
DeleteBackupWithContext(aws.Context, *dynamodb.DeleteBackupInput, ...request.Option) (*dynamodb.DeleteBackupOutput, error)
|
||||
DeleteBackupRequest(*dynamodb.DeleteBackupInput) (*request.Request, *dynamodb.DeleteBackupOutput)
|
||||
|
||||
DeleteItem(*dynamodb.DeleteItemInput) (*dynamodb.DeleteItemOutput, error)
|
||||
DeleteItemWithContext(aws.Context, *dynamodb.DeleteItemInput, ...request.Option) (*dynamodb.DeleteItemOutput, error)
|
||||
DeleteItemRequest(*dynamodb.DeleteItemInput) (*request.Request, *dynamodb.DeleteItemOutput)
|
||||
@@ -83,6 +95,18 @@ type DynamoDBAPI interface {
|
||||
DeleteTableWithContext(aws.Context, *dynamodb.DeleteTableInput, ...request.Option) (*dynamodb.DeleteTableOutput, error)
|
||||
DeleteTableRequest(*dynamodb.DeleteTableInput) (*request.Request, *dynamodb.DeleteTableOutput)
|
||||
|
||||
DescribeBackup(*dynamodb.DescribeBackupInput) (*dynamodb.DescribeBackupOutput, error)
|
||||
DescribeBackupWithContext(aws.Context, *dynamodb.DescribeBackupInput, ...request.Option) (*dynamodb.DescribeBackupOutput, error)
|
||||
DescribeBackupRequest(*dynamodb.DescribeBackupInput) (*request.Request, *dynamodb.DescribeBackupOutput)
|
||||
|
||||
DescribeContinuousBackups(*dynamodb.DescribeContinuousBackupsInput) (*dynamodb.DescribeContinuousBackupsOutput, error)
|
||||
DescribeContinuousBackupsWithContext(aws.Context, *dynamodb.DescribeContinuousBackupsInput, ...request.Option) (*dynamodb.DescribeContinuousBackupsOutput, error)
|
||||
DescribeContinuousBackupsRequest(*dynamodb.DescribeContinuousBackupsInput) (*request.Request, *dynamodb.DescribeContinuousBackupsOutput)
|
||||
|
||||
DescribeGlobalTable(*dynamodb.DescribeGlobalTableInput) (*dynamodb.DescribeGlobalTableOutput, error)
|
||||
DescribeGlobalTableWithContext(aws.Context, *dynamodb.DescribeGlobalTableInput, ...request.Option) (*dynamodb.DescribeGlobalTableOutput, error)
|
||||
DescribeGlobalTableRequest(*dynamodb.DescribeGlobalTableInput) (*request.Request, *dynamodb.DescribeGlobalTableOutput)
|
||||
|
||||
DescribeLimits(*dynamodb.DescribeLimitsInput) (*dynamodb.DescribeLimitsOutput, error)
|
||||
DescribeLimitsWithContext(aws.Context, *dynamodb.DescribeLimitsInput, ...request.Option) (*dynamodb.DescribeLimitsOutput, error)
|
||||
DescribeLimitsRequest(*dynamodb.DescribeLimitsInput) (*request.Request, *dynamodb.DescribeLimitsOutput)
|
||||
@@ -99,6 +123,14 @@ type DynamoDBAPI interface {
|
||||
GetItemWithContext(aws.Context, *dynamodb.GetItemInput, ...request.Option) (*dynamodb.GetItemOutput, error)
|
||||
GetItemRequest(*dynamodb.GetItemInput) (*request.Request, *dynamodb.GetItemOutput)
|
||||
|
||||
ListBackups(*dynamodb.ListBackupsInput) (*dynamodb.ListBackupsOutput, error)
|
||||
ListBackupsWithContext(aws.Context, *dynamodb.ListBackupsInput, ...request.Option) (*dynamodb.ListBackupsOutput, error)
|
||||
ListBackupsRequest(*dynamodb.ListBackupsInput) (*request.Request, *dynamodb.ListBackupsOutput)
|
||||
|
||||
ListGlobalTables(*dynamodb.ListGlobalTablesInput) (*dynamodb.ListGlobalTablesOutput, error)
|
||||
ListGlobalTablesWithContext(aws.Context, *dynamodb.ListGlobalTablesInput, ...request.Option) (*dynamodb.ListGlobalTablesOutput, error)
|
||||
ListGlobalTablesRequest(*dynamodb.ListGlobalTablesInput) (*request.Request, *dynamodb.ListGlobalTablesOutput)
|
||||
|
||||
ListTables(*dynamodb.ListTablesInput) (*dynamodb.ListTablesOutput, error)
|
||||
ListTablesWithContext(aws.Context, *dynamodb.ListTablesInput, ...request.Option) (*dynamodb.ListTablesOutput, error)
|
||||
ListTablesRequest(*dynamodb.ListTablesInput) (*request.Request, *dynamodb.ListTablesOutput)
|
||||
@@ -121,6 +153,14 @@ type DynamoDBAPI interface {
|
||||
QueryPages(*dynamodb.QueryInput, func(*dynamodb.QueryOutput, bool) bool) error
|
||||
QueryPagesWithContext(aws.Context, *dynamodb.QueryInput, func(*dynamodb.QueryOutput, bool) bool, ...request.Option) error
|
||||
|
||||
RestoreTableFromBackup(*dynamodb.RestoreTableFromBackupInput) (*dynamodb.RestoreTableFromBackupOutput, error)
|
||||
RestoreTableFromBackupWithContext(aws.Context, *dynamodb.RestoreTableFromBackupInput, ...request.Option) (*dynamodb.RestoreTableFromBackupOutput, error)
|
||||
RestoreTableFromBackupRequest(*dynamodb.RestoreTableFromBackupInput) (*request.Request, *dynamodb.RestoreTableFromBackupOutput)
|
||||
|
||||
RestoreTableToPointInTime(*dynamodb.RestoreTableToPointInTimeInput) (*dynamodb.RestoreTableToPointInTimeOutput, error)
|
||||
RestoreTableToPointInTimeWithContext(aws.Context, *dynamodb.RestoreTableToPointInTimeInput, ...request.Option) (*dynamodb.RestoreTableToPointInTimeOutput, error)
|
||||
RestoreTableToPointInTimeRequest(*dynamodb.RestoreTableToPointInTimeInput) (*request.Request, *dynamodb.RestoreTableToPointInTimeOutput)
|
||||
|
||||
Scan(*dynamodb.ScanInput) (*dynamodb.ScanOutput, error)
|
||||
ScanWithContext(aws.Context, *dynamodb.ScanInput, ...request.Option) (*dynamodb.ScanOutput, error)
|
||||
ScanRequest(*dynamodb.ScanInput) (*request.Request, *dynamodb.ScanOutput)
|
||||
@@ -136,6 +176,14 @@ type DynamoDBAPI interface {
|
||||
UntagResourceWithContext(aws.Context, *dynamodb.UntagResourceInput, ...request.Option) (*dynamodb.UntagResourceOutput, error)
|
||||
UntagResourceRequest(*dynamodb.UntagResourceInput) (*request.Request, *dynamodb.UntagResourceOutput)
|
||||
|
||||
UpdateContinuousBackups(*dynamodb.UpdateContinuousBackupsInput) (*dynamodb.UpdateContinuousBackupsOutput, error)
|
||||
UpdateContinuousBackupsWithContext(aws.Context, *dynamodb.UpdateContinuousBackupsInput, ...request.Option) (*dynamodb.UpdateContinuousBackupsOutput, error)
|
||||
UpdateContinuousBackupsRequest(*dynamodb.UpdateContinuousBackupsInput) (*request.Request, *dynamodb.UpdateContinuousBackupsOutput)
|
||||
|
||||
UpdateGlobalTable(*dynamodb.UpdateGlobalTableInput) (*dynamodb.UpdateGlobalTableOutput, error)
|
||||
UpdateGlobalTableWithContext(aws.Context, *dynamodb.UpdateGlobalTableInput, ...request.Option) (*dynamodb.UpdateGlobalTableOutput, error)
|
||||
UpdateGlobalTableRequest(*dynamodb.UpdateGlobalTableInput) (*request.Request, *dynamodb.UpdateGlobalTableOutput)
|
||||
|
||||
UpdateItem(*dynamodb.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)
|
||||
UpdateItemWithContext(aws.Context, *dynamodb.UpdateItemInput, ...request.Option) (*dynamodb.UpdateItemOutput, error)
|
||||
UpdateItemRequest(*dynamodb.UpdateItemInput) (*request.Request, *dynamodb.UpdateItemOutput)
|
||||
|
||||
+84
-5
@@ -4,18 +4,56 @@ package dynamodb
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeBackupInUseException for service response error code
|
||||
// "BackupInUseException".
|
||||
//
|
||||
// There is another ongoing conflicting backup control plane operation on the
|
||||
// table. The backups is either being created, deleted or restored to a table.
|
||||
ErrCodeBackupInUseException = "BackupInUseException"
|
||||
|
||||
// ErrCodeBackupNotFoundException for service response error code
|
||||
// "BackupNotFoundException".
|
||||
//
|
||||
// Backup not found for the given BackupARN.
|
||||
ErrCodeBackupNotFoundException = "BackupNotFoundException"
|
||||
|
||||
// ErrCodeConditionalCheckFailedException for service response error code
|
||||
// "ConditionalCheckFailedException".
|
||||
//
|
||||
// A condition specified in the operation could not be evaluated.
|
||||
ErrCodeConditionalCheckFailedException = "ConditionalCheckFailedException"
|
||||
|
||||
// ErrCodeContinuousBackupsUnavailableException for service response error code
|
||||
// "ContinuousBackupsUnavailableException".
|
||||
//
|
||||
// Backups have not yet been enabled for this table.
|
||||
ErrCodeContinuousBackupsUnavailableException = "ContinuousBackupsUnavailableException"
|
||||
|
||||
// ErrCodeGlobalTableAlreadyExistsException for service response error code
|
||||
// "GlobalTableAlreadyExistsException".
|
||||
//
|
||||
// The specified global table already exists.
|
||||
ErrCodeGlobalTableAlreadyExistsException = "GlobalTableAlreadyExistsException"
|
||||
|
||||
// ErrCodeGlobalTableNotFoundException for service response error code
|
||||
// "GlobalTableNotFoundException".
|
||||
//
|
||||
// The specified global table does not exist.
|
||||
ErrCodeGlobalTableNotFoundException = "GlobalTableNotFoundException"
|
||||
|
||||
// ErrCodeInternalServerError for service response error code
|
||||
// "InternalServerError".
|
||||
//
|
||||
// An error occurred on the server side.
|
||||
ErrCodeInternalServerError = "InternalServerError"
|
||||
|
||||
// ErrCodeInvalidRestoreTimeException for service response error code
|
||||
// "InvalidRestoreTimeException".
|
||||
//
|
||||
// An invalid restore time was specified. RestoreDateTime must be between EarliestRestorableDateTime
|
||||
// and LatestRestorableDateTime.
|
||||
ErrCodeInvalidRestoreTimeException = "InvalidRestoreTimeException"
|
||||
|
||||
// ErrCodeItemCollectionSizeLimitExceededException for service response error code
|
||||
// "ItemCollectionSizeLimitExceededException".
|
||||
//
|
||||
@@ -26,16 +64,26 @@ const (
|
||||
// ErrCodeLimitExceededException for service response error code
|
||||
// "LimitExceededException".
|
||||
//
|
||||
// The number of concurrent table requests (cumulative number of tables in the
|
||||
// CREATING, DELETING or UPDATING state) exceeds the maximum allowed of 10.
|
||||
// Up to 50 CreateBackup operations are allowed per second, per account. There
|
||||
// is no limit to the number of daily on-demand backups that can be taken.
|
||||
//
|
||||
// Also, for tables with secondary indexes, only one of those tables can be
|
||||
// in the CREATING state at any point in time. Do not attempt to create more
|
||||
// than one such table simultaneously.
|
||||
// Up to 10 simultaneous table operations are allowed per account. These operations
|
||||
// include CreateTable, UpdateTable, DeleteTable,UpdateTimeToLive, RestoreTableFromBackup,
|
||||
// and RestoreTableToPointInTime.
|
||||
//
|
||||
// For tables with secondary indexes, only one of those tables can be in the
|
||||
// CREATING state at any point in time. Do not attempt to create more than one
|
||||
// such table simultaneously.
|
||||
//
|
||||
// The total limit of tables in the ACTIVE state is 250.
|
||||
ErrCodeLimitExceededException = "LimitExceededException"
|
||||
|
||||
// ErrCodePointInTimeRecoveryUnavailableException for service response error code
|
||||
// "PointInTimeRecoveryUnavailableException".
|
||||
//
|
||||
// Point in time recovery has not yet been enabled for this source table.
|
||||
ErrCodePointInTimeRecoveryUnavailableException = "PointInTimeRecoveryUnavailableException"
|
||||
|
||||
// ErrCodeProvisionedThroughputExceededException for service response error code
|
||||
// "ProvisionedThroughputExceededException".
|
||||
//
|
||||
@@ -47,6 +95,18 @@ const (
|
||||
// in the Amazon DynamoDB Developer Guide.
|
||||
ErrCodeProvisionedThroughputExceededException = "ProvisionedThroughputExceededException"
|
||||
|
||||
// ErrCodeReplicaAlreadyExistsException for service response error code
|
||||
// "ReplicaAlreadyExistsException".
|
||||
//
|
||||
// The specified replica is already part of the global table.
|
||||
ErrCodeReplicaAlreadyExistsException = "ReplicaAlreadyExistsException"
|
||||
|
||||
// ErrCodeReplicaNotFoundException for service response error code
|
||||
// "ReplicaNotFoundException".
|
||||
//
|
||||
// The specified replica is no longer part of the global table.
|
||||
ErrCodeReplicaNotFoundException = "ReplicaNotFoundException"
|
||||
|
||||
// ErrCodeResourceInUseException for service response error code
|
||||
// "ResourceInUseException".
|
||||
//
|
||||
@@ -61,4 +121,23 @@ const (
|
||||
// The operation tried to access a nonexistent table or index. The resource
|
||||
// might not be specified correctly, or its status might not be ACTIVE.
|
||||
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
|
||||
|
||||
// ErrCodeTableAlreadyExistsException for service response error code
|
||||
// "TableAlreadyExistsException".
|
||||
//
|
||||
// A target table with the specified name already exists.
|
||||
ErrCodeTableAlreadyExistsException = "TableAlreadyExistsException"
|
||||
|
||||
// ErrCodeTableInUseException for service response error code
|
||||
// "TableInUseException".
|
||||
//
|
||||
// A target table with the specified name is either being created or deleted.
|
||||
ErrCodeTableInUseException = "TableInUseException"
|
||||
|
||||
// ErrCodeTableNotFoundException for service response error code
|
||||
// "TableNotFoundException".
|
||||
//
|
||||
// A source table with the name TableName does not currently exist within the
|
||||
// subscriber's account.
|
||||
ErrCodeTableNotFoundException = "TableNotFoundException"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user