proto

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON(content []byte, out proto.Message) error

func FromYAML

func FromYAML(content []byte, pb proto.Message) error

func Merge

func Merge(dst, src proto.Message)

func ToAnyWithValidation added in v1.2.7

func ToAnyWithValidation(msg proto.Message) (*anypb.Any, error)

func ToYAML

func ToYAML(pb proto.Message) ([]byte, error)

func Validate added in v1.2.7

func Validate(msg proto.Message) error

Validate validates the given message by calling its ValidateAll or Validate methods.

Types

type MergeFunction

type MergeFunction func(dst, src protoreflect.Message)
var ReplaceMergeFn MergeFunction = func(dst, src protoreflect.Message) {
	dst.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
		dst.Clear(fd)
		return true
	})
	src.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
		dst.Set(fd, v)
		return true
	})
}

ReplaceMergeFn instead of merging all subfields one by one, takes src and set it to dest

type OptionFn

type OptionFn func(options mergeOptions) mergeOptions

func MergeFunctionOptionFn

func MergeFunctionOptionFn(name protoreflect.FullName, function MergeFunction) OptionFn

Jump to

Keyboard shortcuts

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