Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: aws/aws-lambda-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.13.0
Choose a base ref
...
head repository: aws/aws-lambda-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.13.1
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 29, 2019

  1. 205 fix mini panic (#226)

    * fix mini panic
    
    * fix mini panic
    
    * fix mini panic
    apzuk3 authored and bmoffatt committed Aug 29, 2019
    Copy the full SHA
    fe4f484 View commit details
Showing with 11 additions and 2 deletions.
  1. +11 −2 events/attributevalue.go
13 changes: 11 additions & 2 deletions events/attributevalue.go
Original file line number Diff line number Diff line change
@@ -18,6 +18,10 @@ type DynamoDBAttributeValue struct {
dataType DynamoDBDataType
}

// This struct represents DynamoDBAttributeValue which doesn't
// implement fmt.Stringer interface and safely `fmt.Sprintf`able
type dynamoDbAttributeValue DynamoDBAttributeValue

// Binary provides access to an attribute of type Binary.
// Method panics if the attribute is not of type Binary.
func (av DynamoDBAttributeValue) Binary() []byte {
@@ -98,8 +102,13 @@ func (av DynamoDBAttributeValue) NumberSet() []string {
// String provides access to an attribute of type String.
// Method panics if the attribute is not of type String.
func (av DynamoDBAttributeValue) String() string {
av.ensureType(DataTypeString)
return av.value.(string)
if av.dataType == DataTypeString {
return av.value.(string)
}
// If dataType is not DataTypeString during fmt.Sprintf("%#v", ...)
// compiler confuses with fmt.Stringer interface and panics
// instead of printing the struct.
return fmt.Sprintf("%v", dynamoDbAttributeValue(av))
}

// StringSet provides access to an attribute of type String Set.