co11ter/goFAST

No API to check for field's presence

Closed this issue · 2 comments

Hi there.

There seems to be no interface to check if some field is present or absent in a message.

How to understand if some optional scalar field is omitted?

Thanks in advance.

Hi!

You can use pointer like there:

Nullable *uint64 `fast:"20"` // nullable - will skip, if field data is absent

Also, you can check field.Value is nil or not: https://github.com/co11ter/goFAST/blob/master/example_decoder_test.go#L71

Thank you