Version: v0.0.0-...-062eff5 Latest Latest

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

Go to latest
Published: Jun 12, 2018 License: Apache-2.0 Imports: 11 Imported by: 0




This section is empty.


This section is empty.


func EncodeBool

func EncodeBool(v interface{}, ba []byte) ([]byte, error)

EncodeBool encodes input as boolean.

func EncodeDouble

func EncodeDouble(v interface{}, ba []byte) ([]byte, error)

EncodeDouble encode Double.

func EncodeEnum

func EncodeEnum(v interface{}, ba []byte, enumValues []*descriptor.EnumValueDescriptorProto) ([]byte, error)

EncodeEnum encodes enum from string or int inputs

func EncodeFixed32

func EncodeFixed32(v interface{}, ba []byte) ([]byte, error)

EncodeFixed32 encodes FIXED32, SFIXED32

func EncodeFixed64

func EncodeFixed64(v interface{}, ba []byte) ([]byte, error)

EncodeFixed64 encodes FIXED64, SFIXED64

func EncodeFloat

func EncodeFloat(v interface{}, ba []byte) ([]byte, error)

EncodeFloat encode Float.

func EncodeInt

func EncodeInt(v interface{}, ba []byte) ([]byte, error)

EncodeInt encodes (U)INT(32/64)

func EncodeSInt32

func EncodeSInt32(v interface{}, ba []byte) ([]byte, error)

EncodeSInt32 encodes sint32 as zigzag

func EncodeSInt64

func EncodeSInt64(v interface{}, ba []byte) ([]byte, error)

EncodeSInt64 encodes sint64 as zigzag

func EncodeString

func EncodeString(v interface{}, ba []byte) ([]byte, error)

EncodeString encodes string

func EncodeVarint

func EncodeVarint(buf []byte, x uint64) ([]byte, int)

EncodeVarint -- encodeVarint no allocations

func EncodeVarintZeroExtend

func EncodeVarintZeroExtend(ba []byte, x uint64, minBytes int) []byte

EncodeVarintZeroExtend encodes x as Varint in ba. Ensures that encoding is at least minBytes long.


type Builder

type Builder struct {
	// contains filtered or unexported fields

Builder builds encoder based on data

func NewEncoderBuilder

func NewEncoderBuilder(resolver yaml.Resolver, compiler Compiler, skipUnknown bool) *Builder

NewEncoderBuilder creates an EncoderBuilder.

func (Builder) Build

func (c Builder) Build(msgName string, data map[string]interface{}) (Encoder, error)

Build builds an Encoder

type Compiler

type Compiler interface {
	// Compile creates a compiled expression from a string expression
	Compile(expr string) (compiled.Expression, v1beta1.ValueType, error)

Compiler creates a compiled expression from a string expression

type Encoder

type Encoder interface {
	Encode(bag attribute.Bag, ba []byte) ([]byte, error)

Encoder transforms yaml/json that represents protobuf data into []byte String values (rvalues) are treated as expressions that are evaluated using attribute bag at runtime. Quoted String values are treated as literals.

func BuildPrimitiveEncoder

func BuildPrimitiveEncoder(v interface{}, fld *descriptor.FieldDescriptorProto) (Encoder, error)

BuildPrimitiveEncoder encodes the given data and returns a static encoder.

func BuildPrimitiveEvalEncoder

func BuildPrimitiveEvalEncoder(expr compiled.Expression, vt v1beta1.ValueType, fld *descriptor.FieldDescriptorProto) (Encoder, error)

BuildPrimitiveEvalEncoder returns an eval encoder given an expression and a target fieldEncoder

type NamedEncoderBuilderFunc

type NamedEncoderBuilderFunc func(m *descriptor.DescriptorProto, fd *descriptor.FieldDescriptorProto, v interface{}, compiler Compiler) (Encoder, error)

NamedEncoderBuilderFunc funcs have a special way to process input for encoding specific types for example istio...Value field accepts user input in a specific way

Jump to

Keyboard shortcuts

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