Skip to content

Commit

Permalink
CreateTable.Tag tweaks
Browse files Browse the repository at this point in the history
edit godoc, multiple calls to set the same tag will overwrite it
  • Loading branch information
guregu committed Sep 12, 2019
1 parent 77e2c8b commit e6bf9c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion createtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,14 @@ func (ct *CreateTable) Index(index Index) *CreateTable {
return ct
}

// Tag add tag.
// Tag specifies a metadata tag for this table. Multiple tags may be specified.
func (ct *CreateTable) Tag(key, value string) *CreateTable {
for _, tag := range ct.tags {
if *tag.Key == key {
*tag.Value = value
return ct
}
}
tag := &dynamodb.Tag{
Key: aws.String(key),
Value: aws.String(value),
Expand Down
1 change: 1 addition & 0 deletions createtable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestCreateTable(t *testing.T) {
Project("ID-Seq-index", IncludeProjection, "UUID").
Provision(4, 2).
ProvisionIndex("Embedded-index", 1, 2).
Tag("Tag-Key", "old value").
Tag("Tag-Key", "Tag-Value").
input()

Expand Down

0 comments on commit e6bf9c5

Please sign in to comment.