datapb

package
v0.0.0-...-a909d9e Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Overview

Package datapb is a generated protocol buffer package.

It is generated from these files:

datapb/data.proto

It has these top-level messages:

DataHash
DataEntry
Data
DataArray

Index

Examples

Constants

This section is empty.

Variables

View Source
var GenericNilValue = reflect.Zero(interfaceType)
View Source
var InvalidValue = reflect.ValueOf(nil)
View Source
var NullValue_name = map[int32]string{
	0: "NULL_VALUE",
}
View Source
var NullValue_value = map[string]int32{
	"NULL_VALUE": 0,
}

Functions

func FromData

func FromData(v *Data) (reflect.Value, error)

FromData converts a datapb.Data to a reflect.Value

Example
d, _ := ToData(reflect.ValueOf(map[string]int{`t`: 3}))

v, _ := FromData(d)
fmt.Printf("%T '%v'\n", v.Interface(), v.Interface())
Output:

map[string]int64 'map[t:3]'
Example (Intkeys)
d, _ := ToData(reflect.ValueOf(map[int]int{1: 3}))

v, _ := FromData(d)
fmt.Printf("%T '%v'\n", v.Interface(), v.Interface())
Output:

map[int64]int64 'map[1:3]'

Types

type Data

type Data struct {
	// The kind of value.
	//
	// Types that are valid to be assigned to Kind:
	//	*Data_UndefValue
	//	*Data_IntegerValue
	//	*Data_FloatValue
	//	*Data_StringValue
	//	*Data_BooleanValue
	//	*Data_HashValue
	//	*Data_ArrayValue
	//	*Data_BinaryValue
	//	*Data_Reference
	Kind isData_Kind `protobuf_oneof:"kind"`
}

`Data` represents a dynamically typed value which can be either null, an integer, a float, a string, a boolean, a recursive data hash, or an array of data.

func ToData

func ToData(v reflect.Value) (*Data, error)

ToData converts reflect.Value to a datapb.Data

Example
d, _ := ToData(reflect.ValueOf(map[string]int{`t`: 3}))
fmt.Println(d)
Output:

hash_value:<entries:<key:<string_value:"t" > value:<integer_value:3 > > >
Example (FromReflect)
d, _ := ToData(reflect.ValueOf(map[string]reflect.Value{`t`: reflect.ValueOf(3)}))
fmt.Println(d)
Output:

hash_value:<entries:<key:<string_value:"t" > value:<integer_value:3 > > >

func (*Data) Descriptor

func (*Data) Descriptor() ([]byte, []int)

func (*Data) GetArrayValue

func (m *Data) GetArrayValue() *DataArray

func (*Data) GetBinaryValue

func (m *Data) GetBinaryValue() []byte

func (*Data) GetBooleanValue

func (m *Data) GetBooleanValue() bool

func (*Data) GetFloatValue

func (m *Data) GetFloatValue() float64

func (*Data) GetHashValue

func (m *Data) GetHashValue() *DataHash

func (*Data) GetIntegerValue

func (m *Data) GetIntegerValue() int64

func (*Data) GetKind

func (m *Data) GetKind() isData_Kind

func (*Data) GetReference

func (m *Data) GetReference() int64

func (*Data) GetStringValue

func (m *Data) GetStringValue() string

func (*Data) GetUndefValue

func (m *Data) GetUndefValue() NullValue

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) Reset

func (m *Data) Reset()

func (*Data) String

func (m *Data) String() string

func (*Data) XXX_OneofFuncs

func (*Data) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type DataArray

type DataArray struct {
	// Repeated field of dynamically typed values.
	Values []*Data `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
}

`DataArray` is a wrapper around a repeated field of Data values.

func (*DataArray) Descriptor

func (*DataArray) Descriptor() ([]byte, []int)

func (*DataArray) GetValues

func (m *DataArray) GetValues() []*Data

func (*DataArray) ProtoMessage

func (*DataArray) ProtoMessage()

func (*DataArray) Reset

func (m *DataArray) Reset()

func (*DataArray) String

func (m *DataArray) String() string

type DataEntry

type DataEntry struct {
	Key   *Data `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	Value *Data `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

`DataEntry` represents one association between a key and a value in the ordered `DataHash`

func (*DataEntry) Descriptor

func (*DataEntry) Descriptor() ([]byte, []int)

func (*DataEntry) GetKey

func (m *DataEntry) GetKey() *Data

func (*DataEntry) GetValue

func (m *DataEntry) GetValue() *Data

func (*DataEntry) ProtoMessage

func (*DataEntry) ProtoMessage()

func (*DataEntry) Reset

func (m *DataEntry) Reset()

func (*DataEntry) String

func (m *DataEntry) String() string

type DataHash

type DataHash struct {
	// Ordered list of associations between strings and dynamically typed values.
	Entries []*DataEntry `protobuf:"bytes,1,rep,name=entries" json:"entries,omitempty"`
}

`DataHash` represents an ordered hash of Data values, consisting of fields which map to dynamically typed values. In some languages, `DataHash` might be supported by a native representation. For example, in scripting languages like JS, a data hash is represented as an object.

func (*DataHash) Descriptor

func (*DataHash) Descriptor() ([]byte, []int)

func (*DataHash) GetEntries

func (m *DataHash) GetEntries() []*DataEntry

func (*DataHash) ProtoMessage

func (*DataHash) ProtoMessage()

func (*DataHash) Reset

func (m *DataHash) Reset()

func (*DataHash) String

func (m *DataHash) String() string

type Data_ArrayValue

type Data_ArrayValue struct {
	ArrayValue *DataArray `protobuf:"bytes,7,opt,name=array_value,json=arrayValue,oneof"`
}

type Data_BinaryValue

type Data_BinaryValue struct {
	BinaryValue []byte `protobuf:"bytes,8,opt,name=binary_value,json=binaryValue,proto3,oneof"`
}

type Data_BooleanValue

type Data_BooleanValue struct {
	BooleanValue bool `protobuf:"varint,5,opt,name=boolean_value,json=booleanValue,oneof"`
}

type Data_FloatValue

type Data_FloatValue struct {
	FloatValue float64 `protobuf:"fixed64,3,opt,name=float_value,json=floatValue,oneof"`
}

type Data_HashValue

type Data_HashValue struct {
	HashValue *DataHash `protobuf:"bytes,6,opt,name=hash_value,json=hashValue,oneof"`
}

type Data_IntegerValue

type Data_IntegerValue struct {
	IntegerValue int64 `protobuf:"varint,2,opt,name=integer_value,json=integerValue,oneof"`
}

type Data_Reference

type Data_Reference struct {
	Reference int64 `protobuf:"varint,9,opt,name=reference,oneof"`
}

type Data_StringValue

type Data_StringValue struct {
	StringValue string `protobuf:"bytes,4,opt,name=string_value,json=stringValue,oneof"`
}

type Data_UndefValue

type Data_UndefValue struct {
	UndefValue NullValue `protobuf:"varint,1,opt,name=undef_value,json=undefValue,enum=puppet.datapb.NullValue,oneof"`
}

type NullValue

type NullValue int32

`NullValue` is a singleton enumeration to represent the null value for the `Value` type union.

const (
	// Null value.
	NullValue_NULL_VALUE NullValue = 0
)

func (NullValue) EnumDescriptor

func (NullValue) EnumDescriptor() ([]byte, []int)

func (NullValue) String

func (x NullValue) String() string

Jump to

Keyboard shortcuts

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