Skip to content

How to reset attributes? #30

Description

@bfontaine

Hello,

If you take a Company for example, its MonthlySpend field is not serialized if it’s 0 because of the omitempty tag:

type Company struct {
    // ...snip...
    MonthlySpend int32 `json:"monthly_spend,omitempty"`
    //                                      ^
    //                                      |
    //                                      here

This means saving Company{ID: "abc", MonthlySpend: 0} and Company{ID: "abc"} is the same. Shouldn’t you use an *int32 (int32 pointer) instead, and the same on all other reset-able fields?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions