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

Encoding slices is broken on 1.22 when using structs pointer fields - AllWithContext #230

Open
amit-evermile opened this issue Mar 3, 2024 · 3 comments

Comments

@amit-evermile
Copy link

amit-evermile commented Mar 3, 2024

Hi, we are using a struct with pointer fields, example:

type DynamoObj struct {
	Id                   string                `dynamo:"id,hash"`
	OrderId              *string               `dynamo:"order_id"`
	CommunicationType    *string               `dynamo:"communication_type"`
	CreatedAt            int64                 `dynamo:"created_at,unixtime"`
}

When using

result := make([]DynamoObj, 0)
table.Get("id", id).AllWithContext(ctx, &result)

The pointer fields (OrderId, CommunicationType) are overridden with the values from the last record read.
I've verified that this issue doesn't happen on 1.21.

@chriselkins
Copy link

I'm also having this issue. It only started with 1.22 and previous versions did not have this issue.

@guregu
Copy link
Owner

guregu commented May 4, 2024

Sorry about this. I have just released v1.22.2 which should fix this. Please try it out and let me know how it goes. Apologies for not seeing this earlier.

@nightlord189
Copy link
Contributor

Thank you, @guregu. It was fixed for me.

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

4 participants