Skip to content

Commit

Permalink
service/dynamodb/dynamodbattribute: Allow multiple struct tag elements (
Browse files Browse the repository at this point in the history
#886)

Updates the dynamodbattribute marshaler's parsing of the struct tag to not be artificially limited in number of elements. Removes the restriction on the number of elements in the struct tag.
  • Loading branch information
lionelmessi authored and jasdel committed Oct 11, 2016
1 parent d6072f0 commit 0b845ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion service/dynamodb/dynamodbattribute/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (t *tag) parseJSONTag(structTag reflect.StructTag) {
}

func (t *tag) parseTagStr(tagStr string) {
parts := strings.SplitN(tagStr, ",", 2)
parts := strings.Split(tagStr, ",")
if len(parts) == 0 {
return
}
Expand Down
2 changes: 2 additions & 0 deletions service/dynamodb/dynamodbattribute/tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func TestTagParse(t *testing.T) {
{`dynamodbav:",binaryset"`, false, true, tag{AsBinSet: true}},
{`dynamodbav:",numberset"`, false, true, tag{AsNumSet: true}},
{`dynamodbav:",stringset"`, false, true, tag{AsStrSet: true}},
{`dynamodbav:",stringset,omitemptyelem"`, false, true, tag{AsStrSet: true,OmitEmptyElem:true}},
{`dynamodbav:"name,stringset,omitemptyelem"`, false, true, tag{Name: "name",AsStrSet: true,OmitEmptyElem: true}},
}

for i, c := range cases {
Expand Down

0 comments on commit 0b845ba

Please sign in to comment.