enumgen

package
v0.18.86 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 15 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 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.18.86

func ExternalPackageName(fullname, pack string) string

func TrimLocalPackageName added in v0.18.86

func TrimLocalPackageName(val, pack string) string

Types

type EnumDescription added in v0.18.86

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.86

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

type FieldMeta added in v0.18.86

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

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

type FileEnumInfo added in v0.16.75

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

type MessageDescription added in v0.18.86

type MessageDescription struct {
	Name          string
	Display       string
	Fields        []*FieldMeta
	Documentation string
	FullName      string
	TableSource   string
	TableHeader   []string

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

func CreateMessageDescription

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

CreateMessageDescription convert enum descriptor to EnumMeta message

func GetMessagesDescriptions added in v0.18.86

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

type Opts

type Opts struct {
	// Package provides package name
	Package 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