Documentation ¶
Overview ¶
The description (experimental) plugin generates a Description method for each message. The Description method returns a populated google_protobuf.FileDescriptorSet struct. This contains the description of the files used to generate this message.
It is enabled by the following extensions:
- description
- description_all
The description plugin also generates a test given it is enabled using one of the following extensions:
- testgen
- testgen_all
Let us look at:
github.com/Mother-Earth/me-protobuf/test/example/example.proto
Btw all the output can be seen at:
github.com/Mother-Earth/me-protobuf/test/example/*
The following message:
message B { option (gogoproto.description) = true; optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; repeated bytes G = 2 [(gogoproto.customtype) = "github.com/Mother-Earth/me-protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; }
given to the description plugin, will generate the following code:
func (this *B) Description() (desc *google_protobuf.FileDescriptorSet) { return ExampleDescription() }
and the following test code:
func TestDescription(t *testing9.T) { ExampleDescription() }
The hope is to use this struct in some way instead of reflect. This package is subject to change, since a use has not been figured out yet.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.