protos

package
v0.0.95 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TypeUrlPrefix = "type.googleapis.com/"

Variables

This section is empty.

Functions

func CheckConsolidate

func CheckConsolidate[V proto.Message](check V, out *V) bool

func Clone

func Clone[V proto.Message](msg V) V

func NewFromType

func NewFromType[V proto.Message]() V

func TypeUrl

func TypeUrl[V proto.Message]() string

func TypeUrlForInstance

func TypeUrlForInstance(m proto.Message) string

func WrapAnyOrDie

func WrapAnyOrDie(src protoreflect.ProtoMessage) *anypb.Any

func WrapAnysOrDie

func WrapAnysOrDie(srcs ...protoreflect.ProtoMessage) []*anypb.Any

func WriteFile

func WriteFile(path string, msg proto.Message) error

Types

type SerializeOpts

type SerializeOpts struct {
	TextProto bool
	JSON      bool
	Resolver  interface {
		protoregistry.ExtensionTypeResolver
		protoregistry.MessageTypeResolver
	}
}

func (SerializeOpts) Serialize

func (opts SerializeOpts) Serialize(msgs ...proto.Message) ([]TextAndBinary, error)

func (SerializeOpts) SerializeToFS

func (opts SerializeOpts) SerializeToFS(ctx context.Context, target fnfs.WriteFS, m map[string]proto.Message) error

type TextAndBinary

type TextAndBinary struct {
	Text   []byte
	JSON   []byte
	Binary []byte

	PerFormat map[string][]byte // Key, one of: binarypb, textpb, json
}

func SerializeMultiple

func SerializeMultiple(msgs ...proto.Message) ([]TextAndBinary, error)

Jump to

Keyboard shortcuts

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