Bump github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue

Bumps [github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue](https://github.com/aws/aws-sdk-go-v2) from 1.13.19 to 1.14.1.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/credentials/v1.13.19...service/pi/v1.14.1)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2024-06-11 09:17:59 +00:00 committed by GitHub
parent 3599a58a6e
commit e9784dbcd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 105 additions and 24 deletions

4
go.mod
View file

@ -9,7 +9,7 @@ require (
github.com/aws/aws-sdk-go-v2 v1.27.2 github.com/aws/aws-sdk-go-v2 v1.27.2
github.com/aws/aws-sdk-go-v2/config v1.27.16 github.com/aws/aws-sdk-go-v2/config v1.27.16
github.com/aws/aws-sdk-go-v2/credentials v1.17.16 github.com/aws/aws-sdk-go-v2/credentials v1.17.16
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.19 github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.1
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.8 github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.8
github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.8 github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.8
github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20230808105340-e631fe742486 github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20230808105340-e631fe742486
@ -28,7 +28,7 @@ require (
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.8 // indirect github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.10 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.10 // indirect github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.10 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect

8
go.sum
View file

@ -21,8 +21,8 @@ github.com/aws/aws-sdk-go-v2/config v1.27.16 h1:knpCuH7laFVGYTNd99Ns5t+8PuRjDn4H
github.com/aws/aws-sdk-go-v2/config v1.27.16/go.mod h1:vutqgRhDUktwSge3hrC3nkuirzkJ4E/mLj5GvI0BQas= github.com/aws/aws-sdk-go-v2/config v1.27.16/go.mod h1:vutqgRhDUktwSge3hrC3nkuirzkJ4E/mLj5GvI0BQas=
github.com/aws/aws-sdk-go-v2/credentials v1.17.16 h1:7d2QxY83uYl0l58ceyiSpxg9bSbStqBC6BeEeHEchwo= github.com/aws/aws-sdk-go-v2/credentials v1.17.16 h1:7d2QxY83uYl0l58ceyiSpxg9bSbStqBC6BeEeHEchwo=
github.com/aws/aws-sdk-go-v2/credentials v1.17.16/go.mod h1:Ae6li/6Yc6eMzysRL2BXlPYvnrLLBg3D11/AmOjw50k= github.com/aws/aws-sdk-go-v2/credentials v1.17.16/go.mod h1:Ae6li/6Yc6eMzysRL2BXlPYvnrLLBg3D11/AmOjw50k=
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.19 h1:Y9GflNZ9Ty+qjyY7Oral0gcaeI5NiPNHX23vXCiXfe8= github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.1 h1:Uhn/kOwwHAL4vI6LdgvV0cfaQbaLyvJbCCyrSZLNBm8=
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.19/go.mod h1:RACJwWn6am6SvBqlCM9/DKHaR+79Q6/yMx3QCjuq8nw= github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.1/go.mod h1:fEjI/gFP0DXxz5c4tRWyYEQpcNCVvMzjh62t0uKFk8U=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 h1:dQLK4TjtnlRGb0czOht2CevZ5l6RSyRWAnKeGd7VAFE= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 h1:dQLK4TjtnlRGb0czOht2CevZ5l6RSyRWAnKeGd7VAFE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3/go.mod h1:TL79f2P6+8Q7dTsILpiVST+AL9lkF6PPGI167Ny0Cjw= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3/go.mod h1:TL79f2P6+8Q7dTsILpiVST+AL9lkF6PPGI167Ny0Cjw=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 h1:cy8ahBJuhtM8GTTSyOkfy6WVPV1IE+SS5/wfXUYuulw= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 h1:cy8ahBJuhtM8GTTSyOkfy6WVPV1IE+SS5/wfXUYuulw=
@ -33,8 +33,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.8 h1:yOosUCdI/P+gfBd8uXk6lvZmrp7z2Xs8s1caIDP33lo= github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.8 h1:yOosUCdI/P+gfBd8uXk6lvZmrp7z2Xs8s1caIDP33lo=
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.8/go.mod h1:4sYs0Krug9vn4cfDly4ExdbXJRqqZZBVDJNtBHGxCpQ= github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.8/go.mod h1:4sYs0Krug9vn4cfDly4ExdbXJRqqZZBVDJNtBHGxCpQ=
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.8 h1:PapW7iWHqua6Gk+qRjgXpM3fNqUxY3N+1WURHPcmKhc= github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.10 h1:aK9uyT3Ua6UOmTMBYEM3sJHlnSO994eNZGagFlfLiOs=
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.8/go.mod h1:IL6qnQxrc/qIjwzeg7USP3P7ySEehOPpXJslRbXNYJ4= github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.10/go.mod h1:S541uoWn3nWvo28EE8DnMbqZ5sZRAipVUPuL11V08Xw=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg=
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.10 h1:+ijk29Q2FlKCinEzG6GE3IcOyBsmPNUmFq/L82pSyhI= github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.10 h1:+ijk29Q2FlKCinEzG6GE3IcOyBsmPNUmFq/L82pSyhI=

View file

@ -1,3 +1,19 @@
# v1.14.1 (2024-06-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.14.0 (2024-06-05)
* **Feature**: Add codec options to use encoding.Text/Binary(Un)Marshaler when present on targets.
# v1.13.21 (2024-06-03)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.20 (2024-05-28)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.19 (2024-05-24) # v1.13.19 (2024-05-24)
* **Dependency Update**: Updated to the latest SDK module versions * **Dependency Update**: Updated to the latest SDK module versions

View file

@ -231,6 +231,18 @@ type DecoderOptions struct {
// Default string parsing format is time.RFC3339 // Default string parsing format is time.RFC3339
// Default number parsing format is seconds since January 1, 1970 UTC // Default number parsing format is seconds since January 1, 1970 UTC
DecodeTime DecodeTimeAttributes DecodeTime DecodeTimeAttributes
// When enabled, the decoder will use implementations of
// encoding.TextUnmarshaler and encoding.BinaryUnmarshaler when present on
// unmarshaling targets.
//
// If a target implements [Unmarshaler], encoding unmarshaler
// implementations are ignored.
//
// If the attributevalue is a string, its underlying value will be used to
// call UnmarshalText on the target. If the attributevalue is a binary, its
// value will be used to call UnmarshalBinary.
UseEncodingUnmarshalers bool
} }
// A Decoder provides unmarshaling AttributeValues to Go value types. // A Decoder provides unmarshaling AttributeValues to Go value types.
@ -288,17 +300,30 @@ func (d *Decoder) decode(av types.AttributeValue, v reflect.Value, fieldTag tag)
var u Unmarshaler var u Unmarshaler
_, isNull := av.(*types.AttributeValueMemberNULL) _, isNull := av.(*types.AttributeValueMemberNULL)
if av == nil || isNull { if av == nil || isNull {
u, v = indirect(v, indirectOptions{decodeNull: true}) u, v = indirect[Unmarshaler](v, indirectOptions{decodeNull: true})
if u != nil { if u != nil {
return u.UnmarshalDynamoDBAttributeValue(av) return u.UnmarshalDynamoDBAttributeValue(av)
} }
return d.decodeNull(v) return d.decodeNull(v)
} }
u, v = indirect(v, indirectOptions{}) v0 := v
u, v = indirect[Unmarshaler](v, indirectOptions{})
if u != nil { if u != nil {
return u.UnmarshalDynamoDBAttributeValue(av) return u.UnmarshalDynamoDBAttributeValue(av)
} }
if d.options.UseEncodingUnmarshalers {
if s, ok := av.(*types.AttributeValueMemberS); ok {
if u, _ := indirect[encoding.TextUnmarshaler](v0, indirectOptions{}); u != nil {
return u.UnmarshalText([]byte(s.Value))
}
}
if b, ok := av.(*types.AttributeValueMemberB); ok {
if u, _ := indirect[encoding.BinaryUnmarshaler](v0, indirectOptions{}); u != nil {
return u.UnmarshalBinary(b.Value)
}
}
}
switch tv := av.(type) { switch tv := av.(type) {
case *types.AttributeValueMemberB: case *types.AttributeValueMemberB:
@ -420,7 +445,7 @@ func (d *Decoder) decodeBinarySet(bs [][]byte, v reflect.Value) error {
if !isArray { if !isArray {
v.SetLen(i + 1) v.SetLen(i + 1)
} }
u, elem := indirect(v.Index(i), indirectOptions{}) u, elem := indirect[Unmarshaler](v.Index(i), indirectOptions{})
if u != nil { if u != nil {
return u.UnmarshalDynamoDBAttributeValue(&types.AttributeValueMemberBS{Value: bs}) return u.UnmarshalDynamoDBAttributeValue(&types.AttributeValueMemberBS{Value: bs})
} }
@ -555,7 +580,7 @@ func (d *Decoder) decodeNumberSet(ns []string, v reflect.Value) error {
if !isArray { if !isArray {
v.SetLen(i + 1) v.SetLen(i + 1)
} }
u, elem := indirect(v.Index(i), indirectOptions{}) u, elem := indirect[Unmarshaler](v.Index(i), indirectOptions{})
if u != nil { if u != nil {
return u.UnmarshalDynamoDBAttributeValue(&types.AttributeValueMemberNS{Value: ns}) return u.UnmarshalDynamoDBAttributeValue(&types.AttributeValueMemberNS{Value: ns})
} }
@ -634,7 +659,7 @@ func (d *Decoder) decodeMap(avMap map[string]types.AttributeValue, v reflect.Val
for k, av := range avMap { for k, av := range avMap {
key := reflect.New(keyType).Elem() key := reflect.New(keyType).Elem()
// handle pointer keys // handle pointer keys
_, indirectKey := indirect(key, indirectOptions{skipUnmarshaler: true}) _, indirectKey := indirect[Unmarshaler](key, indirectOptions{skipUnmarshaler: true})
if err := decodeMapKey(k, indirectKey, tag{}); err != nil { if err := decodeMapKey(k, indirectKey, tag{}); err != nil {
return &UnmarshalTypeError{ return &UnmarshalTypeError{
Value: fmt.Sprintf("map key %q", k), Value: fmt.Sprintf("map key %q", k),
@ -777,7 +802,7 @@ func (d *Decoder) decodeStringSet(ss []string, v reflect.Value) error {
if !isArray { if !isArray {
v.SetLen(i + 1) v.SetLen(i + 1)
} }
u, elem := indirect(v.Index(i), indirectOptions{}) u, elem := indirect[Unmarshaler](v.Index(i), indirectOptions{})
if u != nil { if u != nil {
return u.UnmarshalDynamoDBAttributeValue(&types.AttributeValueMemberSS{Value: ss}) return u.UnmarshalDynamoDBAttributeValue(&types.AttributeValueMemberSS{Value: ss})
} }
@ -825,7 +850,7 @@ type indirectOptions struct {
// //
// Based on the enoding/json type reflect value type indirection in Go Stdlib // Based on the enoding/json type reflect value type indirection in Go Stdlib
// https://golang.org/src/encoding/json/decode.go indirect func. // https://golang.org/src/encoding/json/decode.go indirect func.
func indirect(v reflect.Value, opts indirectOptions) (Unmarshaler, reflect.Value) { func indirect[U any](v reflect.Value, opts indirectOptions) (U, reflect.Value) {
// Issue #24153 indicates that it is generally not a guaranteed property // Issue #24153 indicates that it is generally not a guaranteed property
// that you may round-trip a reflect.Value by calling Value.Addr().Elem() // that you may round-trip a reflect.Value by calling Value.Addr().Elem()
// and expect the value to still be settable for values derived from // and expect the value to still be settable for values derived from
@ -859,7 +884,8 @@ func indirect(v reflect.Value, opts indirectOptions) (Unmarshaler, reflect.Value
continue continue
} }
if e.Kind() != reflect.Ptr && e.IsValid() { if e.Kind() != reflect.Ptr && e.IsValid() {
return nil, e var u U
return u, e
} }
} }
if v.Kind() != reflect.Ptr { if v.Kind() != reflect.Ptr {
@ -880,7 +906,7 @@ func indirect(v reflect.Value, opts indirectOptions) (Unmarshaler, reflect.Value
v.Set(reflect.New(v.Type().Elem())) v.Set(reflect.New(v.Type().Elem()))
} }
if !opts.skipUnmarshaler && v.Type().NumMethod() > 0 && v.CanInterface() { if !opts.skipUnmarshaler && v.Type().NumMethod() > 0 && v.CanInterface() {
if u, ok := v.Interface().(Unmarshaler); ok { if u, ok := v.Interface().(U); ok {
return u, reflect.Value{} return u, reflect.Value{}
} }
} }
@ -893,7 +919,8 @@ func indirect(v reflect.Value, opts indirectOptions) (Unmarshaler, reflect.Value
} }
} }
return nil, v var u U
return u, v
} }
// A Number represents a Attributevalue number literal. // A Number represents a Attributevalue number literal.

View file

@ -354,8 +354,7 @@ func MarshalListWithOptions(in interface{}, optFns ...func(*EncoderOptions)) ([]
return asList.Value, nil return asList.Value, nil
} }
// EncoderOptions is a collection of options shared between marshaling // EncoderOptions is a collection of options used by the marshaler.
// and unmarshaling
type EncoderOptions struct { type EncoderOptions struct {
// Support other custom struct tag keys, such as `yaml`, `json`, or `toml`. // Support other custom struct tag keys, such as `yaml`, `json`, or `toml`.
// Note that values provided with a custom TagKey must also be supported // Note that values provided with a custom TagKey must also be supported
@ -380,6 +379,19 @@ type EncoderOptions struct {
// //
// Default encoding is time.RFC3339Nano in a DynamoDB String (S) data type. // Default encoding is time.RFC3339Nano in a DynamoDB String (S) data type.
EncodeTime func(time.Time) (types.AttributeValue, error) EncodeTime func(time.Time) (types.AttributeValue, error)
// When enabled, the encoder will use implementations of
// encoding.TextMarshaler and encoding.BinaryMarshaler when present on
// marshaled values.
//
// Implementations are checked in the following order:
// - [Marshaler]
// - encoding.TextMarshaler
// - encoding.BinaryMarshaler
//
// The results of a MarshalText call will convert to string (S), results
// from a MarshalBinary call will convert to binary (B).
UseEncodingMarshalers bool
} }
// An Encoder provides marshaling Go value types to AttributeValues. // An Encoder provides marshaling Go value types to AttributeValues.
@ -438,7 +450,7 @@ func (e *Encoder) encode(v reflect.Value, fieldTag tag) (types.AttributeValue, e
v = valueElem(v) v = valueElem(v)
if v.Kind() != reflect.Invalid { if v.Kind() != reflect.Invalid {
if av, err := tryMarshaler(v); err != nil { if av, err := e.tryMarshaler(v); err != nil {
return nil, err return nil, err
} else if av != nil { } else if av != nil {
return av, nil return av, nil
@ -822,7 +834,7 @@ func isNullableZeroValue(v reflect.Value) bool {
return false return false
} }
func tryMarshaler(v reflect.Value) (types.AttributeValue, error) { func (e *Encoder) tryMarshaler(v reflect.Value) (types.AttributeValue, error) {
if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
v = v.Addr() v = v.Addr()
} }
@ -831,9 +843,35 @@ func tryMarshaler(v reflect.Value) (types.AttributeValue, error) {
return nil, nil return nil, nil
} }
if m, ok := v.Interface().(Marshaler); ok { i := v.Interface()
if m, ok := i.(Marshaler); ok {
return m.MarshalDynamoDBAttributeValue() return m.MarshalDynamoDBAttributeValue()
} }
if e.options.UseEncodingMarshalers {
return e.tryEncodingMarshaler(i)
}
return nil, nil
}
func (e *Encoder) tryEncodingMarshaler(v any) (types.AttributeValue, error) {
if m, ok := v.(encoding.TextMarshaler); ok {
s, err := m.MarshalText()
if err != nil {
return nil, err
}
return &types.AttributeValueMemberS{Value: string(s)}, nil
}
if m, ok := v.(encoding.BinaryMarshaler); ok {
b, err := m.MarshalBinary()
if err != nil {
return nil, err
}
return &types.AttributeValueMemberB{Value: b}, nil
}
return nil, nil return nil, nil
} }

View file

@ -3,4 +3,4 @@
package attributevalue package attributevalue
// goModuleVersion is the tagged release for this module // goModuleVersion is the tagged release for this module
const goModuleVersion = "1.13.19" const goModuleVersion = "1.14.1"

4
vendor/modules.txt vendored
View file

@ -60,7 +60,7 @@ github.com/aws/aws-sdk-go-v2/credentials/endpointcreds/internal/client
github.com/aws/aws-sdk-go-v2/credentials/processcreds github.com/aws/aws-sdk-go-v2/credentials/processcreds
github.com/aws/aws-sdk-go-v2/credentials/ssocreds github.com/aws/aws-sdk-go-v2/credentials/ssocreds
github.com/aws/aws-sdk-go-v2/credentials/stscreds github.com/aws/aws-sdk-go-v2/credentials/stscreds
# github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.19 # github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.14.1
## explicit; go 1.20 ## explicit; go 1.20
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue
# github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 # github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3
@ -82,7 +82,7 @@ github.com/aws/aws-sdk-go-v2/service/dynamodb
github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/customizations github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/customizations
github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/endpoints github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/endpoints
github.com/aws/aws-sdk-go-v2/service/dynamodb/types github.com/aws/aws-sdk-go-v2/service/dynamodb/types
# github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.8 # github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.10
## explicit; go 1.20 ## explicit; go 1.20
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams/types github.com/aws/aws-sdk-go-v2/service/dynamodbstreams/types
# github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 # github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2