Skip to content
New issue

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

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

Already on GitHub? # to your account

omitempty for NULL attribute values from custom marshalers #2739

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

babattles
Copy link
Contributor

Adds an EncoderOption that allows the encoder to omit NULL attribute values when marshaling a field tagged with omitempty.

Related issues:

@babattles babattles requested a review from a team as a code owner August 9, 2024 07:20
@babattles babattles force-pushed the main branch 7 times, most recently from 4d0d56a to abe4878 Compare August 15, 2024 18:34
@babattles babattles force-pushed the main branch 6 times, most recently from b1e2365 to 976f982 Compare August 23, 2024 18:03
@lucix-aws
Copy link
Contributor

Once CI passes I'm going to push a clarification to the doc string on this new field, since omitempty does chop out NULLs for values in the normal marshaling workflow e.g.

type Foo struct {
	A string
	B *string `dynamodbav:",omitempty"` // will get omitted today if B == nil
}

Basically it'll be something like

	// When enabled, the encoder will omit null (NULL) attribute values returned
	// from custom marshalers tagged with `omitempty`.

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

Successfully merging this pull request may close these issues.

2 participants