Closed stevenvachon closed 3 years ago
What you are doing is probably the easiest way to handle it. When you call pl.Float64()
on a payload with pl.DataType != messages.ValTypeDouble
then it will interpret the bytes as a double even though they are supposed to be interpreted as an integer, which results in the meaningless value. You could also switch on the pl.Type
field, but what you did is slightly simpler. I suppose it could panic in the accessors if the data type was wrong to prevent bad data, but using the Value()
method and type switching it is definitely the way to go.
For this SignalFlow query:
It works fine when I use
Int64()
, though. So for now, I'm usingValue()
with type assertions to consistently return a float64: