Documentation
¶
Index ¶
- func InvokeGeneratorForFiles(plugin *protogen.Plugin, generator FileGeneratorFunc) error
- func IterateMessages(messages []*protogen.Message, fn func(message *protogen.Message) error) error
- func NeedsPointer(f *protogen.Field) bool
- func NewFileWithBoilerplate(plugin *protogen.Plugin, file *protogen.File, fileName string) *protogen.GeneratedFile
- func RunProtocPlugin(generator FileGeneratorFunc)
- type FileGeneratorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvokeGeneratorForFiles ¶
func InvokeGeneratorForFiles(plugin *protogen.Plugin, generator FileGeneratorFunc) error
func IterateMessages ¶
IterateMessages iterates over all messages (including embedded nested messages). It skips internal auto generated messages for things like maps. It calls fn for each message. If fn returns an error, iterateMessages will also error. We can't use go 1.23 iterator functions here yet since we support a minimum of go version 1.22.
func NeedsPointer ¶
NeedsPointer returns if a field needs a pointer for setting the value.
func NewFileWithBoilerplate ¶
func NewFileWithBoilerplate(plugin *protogen.Plugin, file *protogen.File, fileName string) *protogen.GeneratedFile
NewFileWithBoilerplate creates a new file with the specified name and prints the starting lines for a generated go file. It starts with some comments containing information about what program was used to generate this file. It then prints the go package, and lastly adds a runtime compatibility check to make sure the runtime has the correct version.
func RunProtocPlugin ¶
func RunProtocPlugin(generator FileGeneratorFunc)