yaml

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeType

func DecodeType(resolver Resolver, desc *descriptor.FieldDescriptorProto) v1beta1.ValueType

DecodeType converts protobuf types to mixer's IL types. Note that due to absence of corresponding types for a variety of concrete values produced by the decoder, the returned value may be an unspecified type.

func FindFieldByName

func FindFieldByName(descriptor *descriptor.DescriptorProto, name string) *descriptor.FieldDescriptorProto

FindFieldByName finds a field descriptor by its name.

func GetBuffer

func GetBuffer() *proto.Buffer

GetBuffer returns a new buffer from the pool

func GetFileDescSet

func GetFileDescSet(path string) (*descriptor.FileDescriptorSet, error)

GetFileDescSet reads proto filedescriptor set from a given file.

func PutBuffer

func PutBuffer(b *proto.Buffer)

PutBuffer returns the buffer back to the pool

func ToFloat

func ToFloat(v interface{}) (float64, bool)

ToFloat type casts input to float64 if it is possible.

func ToInt64

func ToInt64(v interface{}) (int64, bool)

ToInt64 type casts input to int64 if it is possible.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder transforms protobuf-encoded bytes to attribute values.

func NewDecoder

func NewDecoder(resolver Resolver, msgName string, fieldMask map[string]bool) *Decoder

NewDecoder creates a decoder specific to a dynamic proto descriptor. Additionally, it takes as input an optional field mask to avoid decoding unused field values. Field mask is keyed by the message proto field names. A nil field mask implies all fields are decoded. This decoder is specialized to a single-level proto schema (no nested field dereferences in the resulting output).

func (*Decoder) Decode

func (d *Decoder) Decode(b []byte, out *attribute.MutableBag, attrPrefix string) error

Decode function parses wire-encoded bytes to attribute values. The keys are field names in the message specified by the field mask. Attribute prefix is appended to the field names in the output attribute bag.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder transforms yaml that represents protobuf data into []byte

func NewEncoder

func NewEncoder(fds *descriptor.FileDescriptorSet) *Encoder

NewEncoder creates an Encoder

func (*Encoder) EncodeBytes

func (e *Encoder) EncodeBytes(data map[string]interface{}, msgName string, skipUnknown bool) ([]byte, error)

EncodeBytes creates []byte from a yaml representation of a proto.

type Resolver

type Resolver interface {
	ResolveMessage(name string) *descriptor.DescriptorProto
	ResolveEnum(name string) *descriptor.EnumDescriptorProto

	// Resolve service contained in the proto
	ResolveService(namePrefix string) (svc *descriptor.ServiceDescriptorProto, pkg string)
}

Resolver type is used for finding and resolving references inside proto descriptors.

func NewResolver

func NewResolver(fds *descriptor.FileDescriptorSet) Resolver

NewResolver creates a new resolver

Directories

Path Synopsis
Package wire parses and formats the protobuf wire encoding.
Package wire parses and formats the protobuf wire encoding.

Jump to

Keyboard shortcuts

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