Help us shape the future of Go! Take the 2026 Go Developer Survey

enumgen

package
v0.25.123 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyEnums

func ApplyEnums(w io.Writer, opts Opts, enums []*EnumDescription) error

func ApplyEnumsTemplate added in v0.17.78

func ApplyEnumsTemplate(f *protogen.GeneratedFile, opts Opts, enums []*EnumDescription) error

This function is called with a param which contains the entire definition of a method.

func ApplyMessages

func ApplyMessages(w io.Writer, opts Opts, msgs []*MessageDescription) error

func ApplyMessagesTemplate added in v0.17.78

func ApplyMessagesTemplate(f *protogen.GeneratedFile, opts Opts, msgs []*MessageDescription) error

This function is called with a param which contains the entire definition of a method.

func ApplyModels added in v0.23.106

func ApplyModels(w io.Writer, opts Opts, msgs []*MessageDescription) error

func ApplyModelsTemplate added in v0.23.106

func ApplyModelsTemplate(f *protogen.GeneratedFile, opts Opts, msgs []*MessageDescription) error

This function is called with a param which contains the entire definition of a method.

func ApplyTSEnums added in v0.16.75

func ApplyTSEnums(w io.Writer, opts TSOpts, enums []*EnumDescription) error

func ApplyTemplateTS added in v0.16.75

func ApplyTemplateTS(f *protogen.GeneratedFile, opts TSOpts, fileEnumInfos []FileEnumInfo) error

This function is called with a param which contains the entire definition of a method.

func ExternalPackageName added in v0.17.84

func ExternalPackageName(fullname, pkg string) string

func GenerateGoModels added in v0.23.106

func GenerateGoModels(w io.Writer, opts Opts, msgs []*MessageDescription) error

func TrimLocalPackageName added in v0.17.84

func TrimLocalPackageName(name, pkg string) string

Types

type EnumDescription added in v0.18.85

type EnumDescription struct {
	Name          string
	Enums         []*api.EnumMeta
	Documentation string
	IsBitmask     bool
	FullName      string

	ProtogenEnum *protogen.Enum
	Package      string
	FileName     string
}

func CreateEnumDescription

func CreateEnumDescription(en *protogen.Enum) *EnumDescription

CreateEnumDescription convert enum descriptor to EnumMeta message

func GetEnumsDescriptions added in v0.18.85

func GetEnumsDescriptions(gp *protogen.Plugin, opts Opts) []*EnumDescription

func (*EnumDescription) HasGroups added in v0.24.108

func (e *EnumDescription) HasGroups() bool

type FieldMeta added in v0.17.84

type FieldMeta struct {
	Name            string
	FullName        string
	Display         string
	Documentation   string
	Type            string
	SearchType      string
	SearchOptions   api.SearchOption_Enum
	Required        bool
	RequiredOr      []string
	GoName          string
	StructName      string
	Fields          []*FieldMeta
	EnumDescription *EnumDescription
	Min             int32
	Max             int32
	MinCount        int32
	MaxCount        int32
	Deprecated      bool
	Alias           string

	// field is the original field descriptor
	ProtogenField         *protogen.Field
	Package               string
	EnumDescriptionName   string
	FieldsDescriptionName string
}

type FileEnumInfo added in v0.16.75

type FileEnumInfo struct {
	FileName string
	Enums    []*EnumDescription
}

type MessageDescription added in v0.17.84

type MessageDescription struct {
	Name            string
	Display         string
	Fields          []*FieldMeta
	Documentation   string
	FullName        string
	Deprecated      bool
	RefreshInterval uint32
	// IsInput is true if the message is an input message
	IsInput bool
	// IsOutput is true if the message is an output message
	IsOutput bool

	GenerateModel bool

	// message is the original message descriptor
	ProtogenMessage *protogen.Message
	Package         string
}

func CreateMessageDescription

func CreateMessageDescription(msg *protogen.Message, isInput, isOutput bool, args Opts, queueToDiscover map[string]*protogen.Message) *MessageDescription

CreateMessageDescription convert enum descriptor to EnumMeta message

func GetMessagesDescriptions added in v0.18.85

func GetMessagesDescriptions(gp *protogen.Plugin, opts Opts) []*MessageDescription

type Opts

type Opts struct {
	// Package provides package name
	Package      string
	ModelPackage string
}

Opts are the options to set for rendering the template.

type TSOpts added in v0.16.75

type TSOpts struct {
	// BaseImportPath provides the base import path for TypeScript code
	// example: src/services/foo/protogen
	BaseImportPath string
}

TSOpts are the options to set for rendering the template.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL