golang

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Extension       = ".polyglot.go"
	Pointer         = "*"
	MapSuffix       = "Map"
	Slice           = "[]"
	PolyglotAnyKind = "polyglot.AnyKind"
)

Variables

View Source
var (
	RequiredImports = []string{
		"github.com/loopholelabs/polyglot",
		"errors",
	}
)

Functions

func FileName

func FileName(name string) string

func FindValue

func FindValue(field protoreflect.FieldDescriptor) string

func GetKind

func GetKind(kind protoreflect.Kind) string

func GetKindLUT

func GetKindLUT(kind protoreflect.Kind) string

func GetLUTDecoder

func GetLUTDecoder(kind protoreflect.Kind) string

func GetLUTEncoder

func GetLUTEncoder(kind protoreflect.Kind) string

Types

type DecodingFields

type DecodingFields struct {
	MessageFields []protoreflect.FieldDescriptor
	SliceFields   []protoreflect.FieldDescriptor
	Other         []protoreflect.FieldDescriptor
}

func GetDecodingFields

func GetDecodingFields(fields protoreflect.FieldDescriptors) DecodingFields

type EncodingFields

type EncodingFields struct {
	MessageFields []protoreflect.FieldDescriptor
	SliceFields   []protoreflect.FieldDescriptor
	Values        []string
}

func GetEncodingFields

func GetEncodingFields(fields protoreflect.FieldDescriptors) EncodingFields

type Generator

type Generator struct {
	CustomFields func() string
	CustomEncode func() string
	CustomDecode func() string
	// contains filtered or unexported fields
}

func New

func New() *Generator

func (*Generator) ExecuteTemplate

func (g *Generator) ExecuteTemplate(
	genFile *protogen.GeneratedFile,
	protoFile *protogen.File,
	packageName string,
	header bool,
) error

func (*Generator) Generate

func (*Generator) MarshalResponse

func (*Generator) MarshalResponse(res *pluginpb.CodeGeneratorResponse) ([]byte, error)

func (*Generator) UnmarshalRequest

func (*Generator) UnmarshalRequest(buf []byte) (*pluginpb.CodeGeneratorRequest, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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