Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create table incompatible with dynamodbav #114

Open
srinidhis94 opened this issue Jan 16, 2020 · 1 comment
Open

Create table incompatible with dynamodbav #114

srinidhis94 opened this issue Jan 16, 2020 · 1 comment

Comments

@srinidhis94
Copy link

srinidhis94 commented Jan 16, 2020

`

type UserDetails struct {
	UserHash           string             `dynamodbav:"uid,hash"`
	CreationTime       time.Time          `dynamodbav:"creation_time`
	IP                 string             `dynamodbav:"ip" index:"User-IP-Index,hash"`
	UA                 string             `dynamodbav:"ua" index:"User-UA-Index,hash"`
	DerivedInformation string `dynamodbav:"derived_info"`
	UserInformation    string    `dynamodbav:"user_info"`
}
db := dynamo.New(session.New(), &aws.Config{Region: aws.String(config.GetDynamoDBRegion())})
err := db.CreateTable("user_details", dynamo.AWSEncoding(userDetails)).Run()

Stacktrace :

panic: runtime error: index out of range [recovered]
panic: runtime error: index out of range

goroutine 5 [running]:
testing.tRunner.func1(0xc0000ca300)
/usr/local/go/src/testing/testing.go:792 +0x392
panic(0xc4d4a0, 0x146ae40)
/usr/local/go/src/runtime/panic.go:513 +0x1e6
github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo.sortKeySchemas(0x1499c30, 0x0, 0x0)
/home/srinidhi/Amagi/workspace/go/src/github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo/createtable.go:467 +0x232
github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo.(*CreateTable).input(0xc0001f5130, 0x0)
/home/srinidhi/Amagi/workspace/go/src/github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo/createtable.go:308 +0x67
github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo.(*CreateTable).RunWithContext(0xc0001f5130, 0xfba800, 0xc0000889c0, 0x0, 0x0)
/home/srinidhi/Amagi/workspace/go/src/github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo/createtable.go:231 +0x85
github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo.(*CreateTable).Run(0xc0001f5130, 0x0, 0x0)
/home/srinidhi/Amagi/workspace/go/src/github.com/amagimedia/sarvajna/vendor/github.com/guregu/dynamo/createtable.go:223 +0xbb
github.com/amagimedia/sarvajna/db/dynamodb.TestGetDynamoClient(0xc0000ca300)

`

@guregu
Copy link
Owner

guregu commented Feb 4, 2020

I'll look into this but the easiest solution is to just add the dynamo tags to the table (you can have both dynamodbav and dynamo tags on the same field)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants