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

Added omitempty to storage structs #401

Merged
merged 1 commit into from May 19, 2024

Conversation

snej
Copy link
Contributor

@snej snej commented May 10, 2024

Adding omitempty to the JSON metadata of the storage struct fields significantly cuts down the size of the marshaled JSON when a hook is persisting state to a database.

I've left it out on fields that, in my experience, never have the default value; but if you feel it should be consistent on all fields, I can add it to the rest.

@snej
Copy link
Contributor Author

snej commented May 13, 2024

My bad, I forgot to run tests and it appears some test expects the missing fields to exist.

This significantly cuts down the size of the marshaled JSON.

I've left it out on fields that, in my experience, never have the
default value.
Copy link
Member

@werbenhu werbenhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very nice.

@mochi-co
Copy link
Collaborator

This looks good to me, thank you @snej! Apologies for the long wait.

@mochi-co mochi-co merged commit 01f81eb into mochi-mqtt:main May 19, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants