Distinguishing unprovided values from provided zero values
ISE-Admin opened this issue · 0 comments
I'm having an issue with loading public contracts using the ContractsApi.GetContractsPublicRegionId
function.
For optional arguments (e.g. the "reward" field from the corresponding ESI endpoint), is there any way to distinguish between a field that wasn't provided (e.g. a contract that doesn't have a "reward" field, such as an item exchange), vs. a contract where that field was provided, but has a zero value (e.g. a courier contract where the reward is 0
)?
I know I could do a conditional check based on the Type_
field of the resulting GetContractsPublicRegionId200Ok
struct, and only check the Reward
field if it's a contract of type courier
, but that's a lot of switch statements over a lot of endpoints.
The conventional Go way to do this would be for these structs to use pointer type for the optional fields, which would be nil
if they weren't provided in the ESI response.
@antihax