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

add omitempty option #2

Merged
merged 1 commit into from
Aug 13, 2024
Merged

add omitempty option #2

merged 1 commit into from
Aug 13, 2024

Commits on Jul 22, 2024

  1. add omitempty option

    This change adds a `gogoproto.omitempty` option that can be used (in
    conjunction with `(gogoproto.nullable) = false`) for non-nullable
    message fields.
    
    When a message field is not nullable, its tag is always encoded - even
    if all message fields are unset. The `omitempty` option changes the
    marshalling code to check an `Empty()` method on that message, which
    must be defined by the user. The result is that when the message is
    empty, the encoding matches the one we would get if the field was
    nullable and the pointer is unset.
    RaduBerinde committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    b8c361c View commit details
    Browse the repository at this point in the history