|
Hi I am working on a Coupon form in which I have some optional fields. Introduction: All the form field values are received as JSON and mapped into a Golang structure. In the structure, I have added an "omitempty" flag with every field. So only those form values are mapped which have some appropriate value, rest of the values like 0, " ", false are ignored by the structure. Here is the Golang structure
Problem:
Requirement: In future, I want to expose the REST API, So I don't want this thing to be happened there. That is why I don't want to remove "omitempty" flag from the structure fields. Is there any way to save the empty form values or API data fields to the DB while using omitempty flag in the structure? Thanks! |