prototypes

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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