generator

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: BSD-3-Clause Imports: 11 Imported by: 9

Documentation

Index

Constants

View Source
const ProtoPkg = "google.golang.org/protobuf/proto"

Variables

This section is empty.

Functions

func KeySize

func KeySize(fieldNumber protoreflect.FieldNumber, wireType protowire.Type) int

func ProtoWireType

func ProtoWireType(k protoreflect.Kind) protowire.Type

func RegisterFeature

func RegisterFeature(name string, feat Feature)

Types

type Config added in v0.6.0

type Config struct {
	// Poolable rules determines if pool feature generate for particular message
	Poolable ObjectSet
	// PoolableExclude rules determines if pool feature disabled for particular message
	PoolableExclude ObjectSet
	Wrap            bool
	WellKnownTypes  bool
	AllowEmpty      bool
	BuildTag        string
}

type Feature

type Feature func(gen *GeneratedFile) FeatureGenerator

type FeatureGenerator

type FeatureGenerator interface {
	GenerateFile(file *protogen.File) bool
}

type GeneratedFile

type GeneratedFile struct {
	*protogen.GeneratedFile
	Config        *Config
	LocalPackages map[protoreflect.FullName]bool
}

func (*GeneratedFile) Alloc

func (b *GeneratedFile) Alloc(vname string, message *protogen.Message, isQualifiedIdent bool)

func (*GeneratedFile) FieldGoType

func (p *GeneratedFile) FieldGoType(field *protogen.Field) (goType string, pointer bool)

func (*GeneratedFile) Helper added in v0.4.0

func (p *GeneratedFile) Helper(name string) protogen.GoIdent

func (*GeneratedFile) Ident

func (p *GeneratedFile) Ident(path, ident string) string

func (*GeneratedFile) IsLocalField added in v0.6.0

func (p *GeneratedFile) IsLocalField(field *protogen.Field) bool

func (*GeneratedFile) IsLocalMessage

func (p *GeneratedFile) IsLocalMessage(message *protogen.Message) bool

func (*GeneratedFile) IsWellKnownType added in v0.6.0

func (p *GeneratedFile) IsWellKnownType(message *protogen.Message) bool

func (*GeneratedFile) ShouldPool

func (b *GeneratedFile) ShouldPool(message *protogen.Message) bool

func (*GeneratedFile) WellKnownFieldMap added in v0.6.0

func (p *GeneratedFile) WellKnownFieldMap(field *protogen.Field) protogen.GoIdent

func (*GeneratedFile) WellKnownTypeMap added in v0.6.0

func (p *GeneratedFile) WellKnownTypeMap(message *protogen.Message) protogen.GoIdent

func (*GeneratedFile) Wrapper added in v0.6.0

func (p *GeneratedFile) Wrapper() bool

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(plugin *protogen.Plugin, featureNames []string, cfg *Config) (*Generator, error)

func (*Generator) Generate added in v0.6.0

func (gen *Generator) Generate()

type ObjectSet added in v0.6.0

type ObjectSet struct {
	// contains filtered or unexported fields
}

func NewObjectSet added in v0.6.0

func NewObjectSet() ObjectSet

func (ObjectSet) Contains added in v0.6.0

func (o ObjectSet) Contains(g protogen.GoIdent) bool

func (ObjectSet) Set added in v0.6.0

func (o ObjectSet) Set(s string) error

func (ObjectSet) String added in v0.6.0

func (o ObjectSet) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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