2 ms·
working with gRPC allowed me to understand how go(lang)'s use of things like sql.nullstring works (pseudo'ish code}: astring = sql.nullstring{isNull=true, va
by xarope 2y ago
working with gRPC allowed me to understand how go(lang)'s use of things like sql.nullstring works (pseudo'ish code}:
astring = sql.nullstring{isNull=true, value=""}
if astring.isNull {don't do anything}
else {process astring.value}
So similarly, gRPC has a method called HasField, so:
if packet.HasField(astring) {then process packet.astring}
Is it wordy? Yes. Is it elegant? Sadly, No. But does it work? Yes.