grpc 的 BoolValue false 值等于默认值。

huangapple go评论66阅读模式
英文:

grpc BoolValue false value is equal to default one

问题

我在后端的 proto 文件中有一个类型为 BoolValue 的字段,需要在 Android 客户端上将其设置为 true、false 或空。然而,我只能将其设置为 true,尝试创建一个 false 的 BoolValue 只会导致空对象。这是 grpc-java 实现的正常行为吗?我能以某种方式更改吗?谢谢。

英文:

I have a field of type BoolValue in backend proto-file, and need to set it to true, false or empty on Android client.
However, i can set it only to true, the attempt to create a false BoolValue leads to just empty object.
Is it normal behaviour for grpc-java implementation, and can i changed it somehow?
Thanks

grpc 的 BoolValue false 值等于默认值。

答案1

得分: 1

这是正常的行为。无法知道可选字段是否被显式设置或具有默认值。

英文:

That's normal behavior. There no way to know if the optional field was explicitly set or has default value.

huangapple
  • 本文由 发表于 2023年3月9日 22:12:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75685769.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定