gen

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 30 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

View Source
const StaticBytes = false
View Source
const UnSafeClient = false

Variables

This section is empty.

Functions

func FieldValueToTS

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

returns only the formatted value

func GenGoCmd

func GenGoCmd() *cobra.Command

Natural language codegen is in super alpha, only handles a subset of what is available, namely only supports protos that are one level deep with non-repeated primitives, a subset of ruleslang (== and in ops) Also doesn't support external types.

func GenTSCmd

func GenTSCmd() *cobra.Command

Types

type ProtoImport

type ProtoImport struct {
	PackageAlias string
	ImportPath   string
	Type         string
}

func UnpackProtoType

func UnpackProtoType(moduleRoot string, 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