Documentation ¶
Index ¶
- Constants
- func EndWithDefault(field protoreflect.FieldDescriptor) bool
- func EndWithJsonScalar(field protoreflect.FieldDescriptor) bool
- func GetField(msg *protogen.Message, path string) *protogen.Field
- func GetFieldProtoreflect(md protoreflect.MessageDescriptor, path string) protoreflect.FieldDescriptor
- func Intersect(mx []string, my []string, ms ...[]string) []string
- func JsonFieldPath(rootMsg *protogen.Message) func(path string) string
- func ListAllPaths(msg protoreflect.MessageDescriptor) []string
- func ListPaths(prefix string, msg protoreflect.MessageDescriptor, endWith ListPathEndWith) []string
- func RangeField(msg descriptorx.MessageDescriptor, path string, ...) bool
- func RangeFieldPath(path string, f func(field string, restPath string) bool) bool
- func Substract(mx []string, my []string, ms ...[]string) []string
- func Union(mx []string, my []string, ms ...[]string) []string
- type FileGenerator
- func (opt FileGenerator) P(v ...any)
- func (opt FileGenerator) PComment(comments ...string)
- func (opt FileGenerator) PCommentf(format string, args ...interface{})
- func (opt FileGenerator) PTmpl(tmpl *template.Template, data interface{}, funcs ...template.FuncMap)
- func (opt FileGenerator) PTmplStr(tmpl string, data interface{}, funcs ...template.FuncMap)
- func (opt FileGenerator) Pf(format string, v ...any)
- type ForEachFileRunner
- type GenerateOptions
- type ListPathEndWith
- type PluginInfo
- type PreForEachFileRunner
Constants ¶
View Source
const ListPathDepthMax = 10
Variables ¶
This section is empty.
Functions ¶
func EndWithDefault ¶ added in v1.0.26
func EndWithDefault(field protoreflect.FieldDescriptor) bool
func EndWithJsonScalar ¶ added in v1.0.26
func EndWithJsonScalar(field protoreflect.FieldDescriptor) bool
func GetFieldProtoreflect ¶ added in v1.0.26
func GetFieldProtoreflect(md protoreflect.MessageDescriptor, path string) protoreflect.FieldDescriptor
func Intersect ¶ added in v1.0.26
Intersect returns the intersection of all the paths in the input field masks.
func JsonFieldPath ¶ added in v1.0.26
func ListAllPaths ¶ added in v1.0.26
func ListAllPaths(msg protoreflect.MessageDescriptor) []string
func ListPaths ¶ added in v1.0.26
func ListPaths(prefix string, msg protoreflect.MessageDescriptor, endWith ListPathEndWith) []string
func RangeField ¶ added in v1.0.26
func RangeField(msg descriptorx.MessageDescriptor, path string, fn func(field descriptorx.FieldDescriptor, restPath string) bool) bool
func RangeFieldPath ¶ added in v1.0.26
RangeFieldPath is like strings.Split(path, "."), but avoids allocations by iterating over each field in place and calling a iterator function.
Types ¶
type FileGenerator ¶
type FileGenerator struct { W *protogen.GeneratedFile // The file to write to F *protogen.File // The proto file descr }
func (FileGenerator) P ¶
func (opt FileGenerator) P(v ...any)
P is a shorthand for (*protogen.GeneratedFile).P()
func (FileGenerator) PComment ¶ added in v1.0.12
func (opt FileGenerator) PComment(comments ...string)
PComment allows multiple lines string as comment.
func (FileGenerator) PCommentf ¶ added in v1.0.12
func (opt FileGenerator) PCommentf(format string, args ...interface{})
PCommentf allows formatted string as comment.
func (FileGenerator) PTmpl ¶ added in v1.0.21
func (opt FileGenerator) PTmpl(tmpl *template.Template, data interface{}, funcs ...template.FuncMap)
func (FileGenerator) PTmplStr ¶ added in v1.0.21
func (opt FileGenerator) PTmplStr(tmpl string, data interface{}, funcs ...template.FuncMap)
func (FileGenerator) Pf ¶
func (opt FileGenerator) Pf(format string, v ...any)
Pf is same as P, but with formatted string.
type ForEachFileRunner ¶ added in v1.0.12
type ForEachFileRunner interface {
Run(fn func(genOpt GenerateOptions) error)
}
type GenerateOptions ¶ added in v1.0.12
type GenerateOptions struct { FileGenerator PluginInfo }
func (GenerateOptions) PHeader ¶ added in v1.0.12
func (opt GenerateOptions) PHeader(p *protogen.Plugin)
func (GenerateOptions) PPackage ¶ added in v1.0.12
func (opt GenerateOptions) PPackage()
type ListPathEndWith ¶ added in v1.0.26
type ListPathEndWith func(field protoreflect.FieldDescriptor) bool
type PluginInfo ¶ added in v1.0.12
type PreForEachFileRunner ¶ added in v1.0.12
type PreForEachFileRunner interface {
ForEachFileThat(fn func(protoFile *protogen.File) bool) ForEachFileRunner
}
func NewForEachFileRunner ¶ added in v1.0.12
func NewForEachFileRunner(info PluginInfo) PreForEachFileRunner
ForEachFileRunner helps to generate one file for each file that is being generated
Source Files ¶
Click to show internal directories.
Click to hide internal directories.