guregu / dynamo

expressive DynamoDB library for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

func (*CreateTable) Index has no test and seems broken

irohiroki opened this issue · comments

the function calls (*CreateTable) add with HashKeyType like below

ct.add(index.HashKey, string(index.HashKeyType))

but the add func expects AttributeType string.

dynamo/createtable.go

Lines 418 to 421 in f4c2f4c

ct.attribs = append(ct.attribs, &dynamodb.AttributeDefinition{
AttributeName: &name,
AttributeType: &typ,
})

I wonder if anyone uses this feature and we cloud drop it in a major update.

I don't think it's broken. I added some tests to verify it and it looks OK.
It's collecting a map of attribute names to types, needed for the primary keys and index keys.
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html#DDB-CreateTable-request-AttributeDefinitions

ok, great! I think I referenced a wrong type. Thank you for double checking!