我在 Go 中需要这样的结构:
type SomeStruct struct{
Foo bool
Bar interface{}
}
如何在*.proto文件中定义空接口(interface)?如果这不可能,那么如何解决变量类型 *.proto 文件字段的描述问题?
最佳答案
Protobuf 不支持泛型类型。
因为我知道所有可能的类型,所以我可以使用 Oneof
:Oneof
关于go - 如何在 *.proto 文件中定义空接口(interface)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55672809/