gen

package
v0.3.31 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Technically this file is specific to go, but the functions themselves are useful in general. We should generalize this to work in all langs but have the logic shared somehow. For now we are hacking shit across files.

Index

Constants

This section is empty.

Variables

View Source
var TypeRegistry *protoregistry.Types

Functions

func DescriptorToStructDeclaration added in v0.3.31

func DescriptorToStructDeclaration(d protoreflect.MessageDescriptor) string

func FieldDescriptorToTS added in v0.3.31

func FieldDescriptorToTS(f protoreflect.FieldDescriptor) string

func FieldValueToTS

func FieldValueToTS(f protoreflect.FieldDescriptor, val protoreflect.Value) string

returns only the formatted value

func GenAuto added in v0.3.28

func GenAuto(ctx context.Context, configRepoPath, codeRepoPath string) (err error)

func GenNative added in v0.3.28

func GenNative(ctx context.Context, project *native.Project, lekkoPath, repoPath string, opts GenOptions) (err error)

func GenTS

func GenTS(ctx context.Context, repoPath, ns string, getWriter func() (io.Writer, error)) error

func GenTSForFeature added in v0.3.26

func GenTSForFeature(f *featurev1beta1.Feature, ns string, parameters string) (string, error)

func GetTSInterface added in v0.3.31

func GetTSInterface(d protoreflect.MessageDescriptor) (string, error)

func NewGoGenerator

func NewGoGenerator(moduleRoot, outputPath, lekkoPath, repoPath, namespace string) (*goGenerator, error)

Types

type GenOptions added in v0.3.28

type GenOptions struct {
	CodeRepoPath string
	Namespaces   []string
	InitMode     bool
}

type ProtoImport

type ProtoImport struct {
	PackageAlias string
	ImportPath   string
	Type         string
}

func UnpackProtoType

func UnpackProtoType(moduleRoot, outputPath, typeURL string) *ProtoImport

This function handles both the google.protobuf.Any.TypeURL variable which has the format of `types.googleapis.com/fully.qualified.v1beta1.Proto` and purely `fully.qualified.v1beta1.Proto`

return nil if typeURL is empty. Panics on any problems like the rest of the file.

Jump to

Keyboard shortcuts

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