I want to define a golang
type in .proto
file. The type is a slice of other type which is defined in .proto file.
I have types as below.
type SomeType struct {
// few fields
}
type SomeTypes []SomeType
I have SomeType
is defined in .proto file as below.
message SomeType {
//
}
Now I want to define type SomeTypes
in .proto file. But I have not found any way to do that. The simplest solution for me is to change type SomeTypes
as below:
type SomeTypes struct {
Content []SomeType
}
Then I can define that in .proto file as
message SomeTypes {
repeated SomeType Content = 1 [(gogoproto.nullable) = false];
}
But I want to know if there is any solution which does not involve changing the struct SomeTypes
I am using proto2
.