Some changelog values like title, domain, ... are optional strings, so they can be a string or NULL in db. When updating these fields through a PATCH request we need to differentiate between a null, zero and defined value, to be able to either unset the value, keep the old value or overwrite it.
This is my proposal on how to handle user input through the API:
JSON
Action
null
set to NULL
missing or zero value
keep old value
defined
overwrite DB value
I currently could not find a go package that provides these information from marshalled fields, so I probably need to write my own package, to get access to the information IsNull(), IsZero(), String()
Some changelog values like
title, domain, ...
are optional strings, so they can be astring
orNULL
in db. When updating these fields through aPATCH
request we need to differentiate between anull
,zero
anddefined
value, to be able to either unset the value, keep the old value or overwrite it.null
NULL
zero
valueI currently could not find a go package that provides these information from marshalled fields, so I probably need to write my own package, to get access to the information
IsNull(), IsZero(), String()