mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-12-03 18:53:56 +00:00
Update deps
This commit is contained in:
7
vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/decode.go
generated
vendored
7
vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/decode.go
generated
vendored
@@ -449,7 +449,10 @@ func (d *Decoder) decodeMap(avMap map[string]*dynamodb.AttributeValue, v reflect
|
||||
fields := unionStructFields(v.Type(), d.MarshalOptions)
|
||||
for k, av := range avMap {
|
||||
if f, ok := fieldByName(fields, k); ok {
|
||||
fv := v.FieldByIndex(f.Index)
|
||||
fv := fieldByIndex(v, f.Index, func(v *reflect.Value) bool {
|
||||
v.Set(reflect.New(v.Type().Elem()))
|
||||
return true // to continue the loop.
|
||||
})
|
||||
if err := d.decode(av, fv, f.tag); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -655,7 +658,7 @@ func (e *InvalidUnmarshalError) Message() string {
|
||||
return "cannot unmarshal to nil value"
|
||||
}
|
||||
if e.Type.Kind() != reflect.Ptr {
|
||||
return "cannot unmasrhal to non-pointer value, got " + e.Type.String()
|
||||
return "cannot unmarshal to non-pointer value, got " + e.Type.String()
|
||||
}
|
||||
return "cannot unmarshal to nil value, " + e.Type.String()
|
||||
}
|
||||
|
||||
26
vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go
generated
vendored
26
vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go
generated
vendored
@@ -182,6 +182,23 @@ func (e *Encoder) Encode(in interface{}) (*dynamodb.AttributeValue, error) {
|
||||
return av, nil
|
||||
}
|
||||
|
||||
func fieldByIndex(v reflect.Value, index []int,
|
||||
OnEmbeddedNilStruct func(*reflect.Value) bool) reflect.Value {
|
||||
fv := v
|
||||
for i, x := range index {
|
||||
if i > 0 {
|
||||
if fv.Kind() == reflect.Ptr && fv.Type().Elem().Kind() == reflect.Struct {
|
||||
if fv.IsNil() && !OnEmbeddedNilStruct(&fv) {
|
||||
break
|
||||
}
|
||||
fv = fv.Elem()
|
||||
}
|
||||
}
|
||||
fv = fv.Field(x)
|
||||
}
|
||||
return fv
|
||||
}
|
||||
|
||||
func (e *Encoder) encode(av *dynamodb.AttributeValue, v reflect.Value, fieldTag tag) error {
|
||||
// We should check for omitted values first before dereferencing.
|
||||
if fieldTag.OmitEmpty && emptyValue(v) {
|
||||
@@ -233,7 +250,14 @@ func (e *Encoder) encodeStruct(av *dynamodb.AttributeValue, v reflect.Value) err
|
||||
return &InvalidMarshalError{msg: "map key cannot be empty"}
|
||||
}
|
||||
|
||||
fv := v.FieldByIndex(f.Index)
|
||||
found := true
|
||||
fv := fieldByIndex(v, f.Index, func(v *reflect.Value) bool {
|
||||
found = false
|
||||
return false // to break the loop.
|
||||
})
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
elem := &dynamodb.AttributeValue{}
|
||||
err := e.encode(elem, fv, f.tag)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user