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 ¶
- Variables
- func FromData(v *Data) (reflect.Value, error)
- type Data
- func (*Data) Descriptor() ([]byte, []int)
- func (m *Data) GetArrayValue() *DataArray
- func (m *Data) GetBinaryValue() []byte
- func (m *Data) GetBooleanValue() bool
- func (m *Data) GetFloatValue() float64
- func (m *Data) GetHashValue() *DataHash
- func (m *Data) GetIntegerValue() int64
- func (m *Data) GetKind() isData_Kind
- func (m *Data) GetReference() int64
- func (m *Data) GetStringValue() string
- func (m *Data) GetUndefValue() NullValue
- func (*Data) ProtoMessage()
- func (m *Data) Reset()
- func (m *Data) String() string
- func (*Data) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type DataArray
- type DataEntry
- type DataHash
- type Data_ArrayValue
- type Data_BinaryValue
- type Data_BooleanValue
- type Data_FloatValue
- type Data_HashValue
- type Data_IntegerValue
- type Data_Reference
- type Data_StringValue
- type Data_UndefValue
- type NullValue
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var GenericNilValue = reflect.Zero(interfaceType)
var InvalidValue = reflect.ValueOf(nil)
var NullValue_name = map[int32]string{
0: "NULL_VALUE",
}
var NullValue_value = map[string]int32{
"NULL_VALUE": 0,
}
Functions ¶
func FromData ¶
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 ¶
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) GetArrayValue ¶
func (*Data) GetBinaryValue ¶
func (*Data) GetBooleanValue ¶
func (*Data) GetFloatValue ¶
func (*Data) GetHashValue ¶
func (*Data) GetIntegerValue ¶
func (*Data) GetReference ¶
func (*Data) GetStringValue ¶
func (*Data) GetUndefValue ¶
func (*Data) ProtoMessage ¶
func (*Data) ProtoMessage()
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) ProtoMessage ¶
func (*DataArray) ProtoMessage()
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) ProtoMessage ¶
func (*DataEntry) ProtoMessage()
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) GetEntries ¶
func (*DataHash) ProtoMessage ¶
func (*DataHash) ProtoMessage()
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"`
}