protobuf friendly
it would be awesome if we can use it with Protobuf.
I’ll look into it. The go-trader uses doubles in grpc - which is not really correct - for ease of development at the time. So it would be a worthwhile change.
A big problem is the protobufs is cross platform, so the only reasonable way would be to encode as strings, but have the Go Marshall to/from fixed.
please check this protobuf
https://github.com/googleapis/googleapis/blob/master/google/type/money.proto
Yes, but my initial reading shows that to make it work you need either built in support by Google for the type, or you have to treat it as a struct, which a Fixed is not. I don’t see any easy way to do a custom Marshall like with Json.
See this https://github.com/protocolbuffers/protobuf/issues/2483
It looks like you would have to call a to/from method for every field access.
Which would also then require exposing read and write access to the internal long. But it would be better than encoding as string since it would be more efficient.
please read this helper library for timestamp https://github.com/golang/protobuf/blob/master/ptypes/timestamp.go
@k1ng440 I understand, but if you notice Timestamp is an approved 'known type' by the protobufs project and that is why it is directly (and easily) supported.
protobufs would need to declare a "fixed place" decimal to allow fixed.Fixed to work as easily.
closing this as infeasible