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?
Hello,
If you take a
Companyfor example, itsMonthlySpendfield is not serialized if it’s0because of theomitemptytag:This means saving
Company{ID: "abc", MonthlySpend: 0}andCompany{ID: "abc"}is the same. Shouldn’t you use an*int32(int32pointer) instead, and the same on all other reset-able fields?