prototypes

package
v0.3.5-releasetest.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SerializableTypes

type SerializableTypes struct {
	Types             *protoregistry.Types
	FileDescriptorSet *descriptorpb.FileDescriptorSet
}

Wrapper around a user-defined registry that allows it to be serialized. Under the hood, the go-native types and the file descriptor set are kept in-sync. If types are registered in one, they are added to the serializable object as well. FileDescriptorSet is a protobuf object that can be serialized and shared with external systems (e.g. the frontend)

func BuildDynamicTypeRegistry

func BuildDynamicTypeRegistry(ctx context.Context, protoDir string, provider fs.Provider) (*SerializableTypes, error)

Takes a path to the protobuf directory in the config repo, and generates a registry of user-defined types. This registry implements the Resolver interface, which is useful for compiling to json.

func BuildDynamicTypeRegistryFromBufImage

func BuildDynamicTypeRegistryFromBufImage(image []byte) (*SerializableTypes, error)

func NewSerializableTypes

func NewSerializableTypes() *SerializableTypes

func ReBuildDynamicTypeRegistry

func ReBuildDynamicTypeRegistry(ctx context.Context, protoDir string, useExternalTypes bool, cw fs.ConfigWriter) (*SerializableTypes, error)

Note: this method is not safe to be run on ephemeral repos, as it invokes the buf cmd line.

func RegisterDynamicTypes

func RegisterDynamicTypes(files *protoregistry.Files) (*SerializableTypes, error)

func (*SerializableTypes) AddFileDescriptor

func (st *SerializableTypes) AddFileDescriptor(fd protoreflect.FileDescriptor, checkNotExists bool) error

Jump to

Keyboard shortcuts

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