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

Put a embed struct, a panic occurs #247

Closed
karasawako opened this issue Aug 28, 2024 · 3 comments
Closed

Put a embed struct, a panic occurs #247

karasawako opened this issue Aug 28, 2024 · 3 comments

Comments

@karasawako
Copy link

I have confirmed this with v2.2.0.
If I put the following structure to DynamoDB, a panic occurs.

type ServerResponse struct {
    EmbeddedID int
}
type TestAddition struct {
    ServerResponse
}
type TestItem struct {
    ID int `dynamo:"id,hash" json:"id"`
    Name string `dynamo:"name,range" json:"name"`
    Addition TestAddition `dynamo:"addition,omitempty"`
}

tbl.Put(TestItem{ID: 1, Name: "test"}).Run(ctx)

This is because field.isZero == nil is set on line 257 of reflect.go.
Is it possible to include an embed structure in Put?

@guregu
Copy link
Owner

guregu commented Aug 29, 2024

Looks like a bug. Thanks for the report, I'll fix it.

@guregu
Copy link
Owner

guregu commented Aug 29, 2024

I released v2.2.1 with a fix. Thanks again!

@karasawako
Copy link
Author

Quick fix, thanks!

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