当前位置: 首页>>代码示例>>Golang>>正文


Golang Buffer.DecodeStringBytes方法代码示例

本文整理汇总了Golang中github.com/golang/protobuf/proto.Buffer.DecodeStringBytes方法的典型用法代码示例。如果您正苦于以下问题:Golang Buffer.DecodeStringBytes方法的具体用法?Golang Buffer.DecodeStringBytes怎么用?Golang Buffer.DecodeStringBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/golang/protobuf/proto.Buffer的用法示例。


在下文中一共展示了Buffer.DecodeStringBytes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: _LogEntry_OneofUnmarshaler

func _LogEntry_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*LogEntry)
	switch tag {
	case 2: // payload.proto_payload
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(google_protobuf1.Any)
		err := b.DecodeMessage(msg)
		m.Payload = &LogEntry_ProtoPayload{msg}
		return true, err
	case 3: // payload.text_payload
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Payload = &LogEntry_TextPayload{x}
		return true, err
	case 6: // payload.json_payload
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(google_protobuf2.Struct)
		err := b.DecodeMessage(msg)
		m.Payload = &LogEntry_JsonPayload{msg}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:vburenin,项目名称:firempq,代码行数:30,代码来源:log_entry.pb.go

示例2: _TestQuery_OneofUnmarshaler

func _TestQuery_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*TestQuery)
	switch tag {
	case 1: // query.id
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Query = &TestQuery_Id{x}
		return true, err
	case 2: // query.wildcard
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(TestQuery_Wildcard)
		err := b.DecodeMessage(msg)
		m.Query = &TestQuery_Wildcard_{msg}
		return true, err
	case 3: // query.regex
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(TestQuery_Regex)
		err := b.DecodeMessage(msg)
		m.Query = &TestQuery_Regex_{msg}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:bacsorg,项目名称:problem_single,代码行数:30,代码来源:testing.pb.go

示例3: _GaugeResponse_OneofUnmarshaler

func _GaugeResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*GaugeResponse)
	switch tag {
	case 2: // value.long_value
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &GaugeResponse_LongValue{int64(x)}
		return true, err
	case 3: // value.double_value
		if wire != proto.WireFixed64 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed64()
		m.Value = &GaugeResponse_DoubleValue{math.Float64frombits(x)}
		return true, err
	case 4: // value.string_value
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Value = &GaugeResponse_StringValue{x}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:ruinanchen,项目名称:grpc-go,代码行数:28,代码来源:metrics.pb.go

示例4: Unmarshal

// Unmarshal deserializes a `NsReadWriteSet`
func (nsRW *NsReadWriteSet) Unmarshal(buf *proto.Buffer) error {
	var err error
	if nsRW.NameSpace, err = buf.DecodeStringBytes(); err != nil {
		return err
	}
	var numReads uint64
	if numReads, err = buf.DecodeVarint(); err != nil {
		return err
	}
	for i := 0; i < int(numReads); i++ {
		r := &KVRead{}
		if err = r.Unmarshal(buf); err != nil {
			return err
		}
		nsRW.Reads = append(nsRW.Reads, r)
	}

	var numWrites uint64
	if numWrites, err = buf.DecodeVarint(); err != nil {
		return err
	}
	for i := 0; i < int(numWrites); i++ {
		w := &KVWrite{}
		if err = w.Unmarshal(buf); err != nil {
			return err
		}
		nsRW.Writes = append(nsRW.Writes, w)
	}
	return nil
}
开发者ID:hyperledger,项目名称:fabric,代码行数:31,代码来源:rwset.go

示例5: _MsgWithOneof_OneofUnmarshaler

func _MsgWithOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*MsgWithOneof)
	switch tag {
	case 1: // union.title
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Union = &MsgWithOneof_Title{x}
		return true, err
	case 2: // union.salary
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Union = &MsgWithOneof_Salary{int64(x)}
		return true, err
	case 3: // union.Country
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Union = &MsgWithOneof_Country{x}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:vozhyk-,项目名称:gohan,代码行数:28,代码来源:test_objects.pb.go

示例6: _Argument_OneofUnmarshaler

func _Argument_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Argument)
	switch tag {
	case 1: // value.number
		if wire != proto.WireFixed64 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed64()
		m.Value = &Argument_Number{math.Float64frombits(x)}
		return true, err
	case 2: // value.str
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Value = &Argument_Str{x}
		return true, err
	case 3: // value.boolean
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &Argument_Boolean{x != 0}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:redspread,项目名称:spread,代码行数:28,代码来源:object.pb.go

示例7: _Metric_OneofUnmarshaler

func _Metric_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Metric)
	switch tag {
	case 9: // data.string_data
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Data = &Metric_StringData{x}
		return true, err
	case 10: // data.float32_data
		if wire != proto.WireFixed32 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed32()
		m.Data = &Metric_Float32Data{math.Float32frombits(uint32(x))}
		return true, err
	case 11: // data.float64_data
		if wire != proto.WireFixed64 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed64()
		m.Data = &Metric_Float64Data{math.Float64frombits(x)}
		return true, err
	case 12: // data.int32_data
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Data = &Metric_Int32Data{int32(x)}
		return true, err
	case 13: // data.int64_data
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Data = &Metric_Int64Data{int64(x)}
		return true, err
	case 14: // data.bytes_data
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeRawBytes(true)
		m.Data = &Metric_BytesData{x}
		return true, err
	case 15: // data.bool_data
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Data = &Metric_BoolData{x != 0}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:katarzyna-z,项目名称:snap,代码行数:56,代码来源:plugin.pb.go

示例8: _Column_OneofUnmarshaler

func _Column_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Column)
	switch tag {
	case 1: // value.string
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Value = &Column_String_{x}
		return true, err
	case 2: // value.int32
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &Column_Int32{int32(x)}
		return true, err
	case 3: // value.int64
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &Column_Int64{int64(x)}
		return true, err
	case 4: // value.uint32
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &Column_Uint32{uint32(x)}
		return true, err
	case 5: // value.uint64
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &Column_Uint64{x}
		return true, err
	case 6: // value.bytes
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeRawBytes(true)
		m.Value = &Column_Bytes{x}
		return true, err
	case 7: // value.bool
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &Column_Bool{x != 0}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:hyperledger,项目名称:fabric,代码行数:56,代码来源:table.pb.go

示例9: _Field_OneofUnmarshaler

func _Field_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Field)
	switch tag {
	case 2: // value.number
		if wire != proto.WireFixed64 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed64()
		m.Value = &Field_Number{math.Float64frombits(x)}
		return true, err
	case 3: // value.str
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Value = &Field_Str{x}
		return true, err
	case 4: // value.boolean
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &Field_Boolean{x != 0}
		return true, err
	case 5: // value.object
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Object)
		err := b.DecodeMessage(msg)
		m.Value = &Field_Object{msg}
		return true, err
	case 6: // value.array
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Array)
		err := b.DecodeMessage(msg)
		m.Value = &Field_Array{msg}
		return true, err
	case 7: // value.link
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Link)
		err := b.DecodeMessage(msg)
		m.Value = &Field_Link{msg}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:redspread,项目名称:spread,代码行数:52,代码来源:object.pb.go

示例10: _Value_OneofUnmarshaler

func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Value)
	switch tag {
	case 1: // kind.null_value
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Kind = &Value_NullValue{NullValue(x)}
		return true, err
	case 2: // kind.number_value
		if wire != proto.WireFixed64 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed64()
		m.Kind = &Value_NumberValue{math.Float64frombits(x)}
		return true, err
	case 3: // kind.string_value
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Kind = &Value_StringValue{x}
		return true, err
	case 4: // kind.bool_value
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Kind = &Value_BoolValue{x != 0}
		return true, err
	case 5: // kind.struct_value
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Struct)
		err := b.DecodeMessage(msg)
		m.Kind = &Value_StructValue{msg}
		return true, err
	case 6: // kind.list_value
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(ListValue)
		err := b.DecodeMessage(msg)
		m.Kind = &Value_ListValue{msg}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:peter-edge,项目名称:importserver-go,代码行数:51,代码来源:struct.pb.go

示例11: _RowValue_OneofUnmarshaler

func _RowValue_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*RowValue)
	switch tag {
	case 1: // value.str
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Value = &RowValue_Str{x}
		return true, err
	case 2: // value.int
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &RowValue_Int{int32(x)}
		return true, err
	case 3: // value.real
		if wire != proto.WireFixed32 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed32()
		m.Value = &RowValue_Real{math.Float32frombits(uint32(x))}
		return true, err
	case 4: // value.date
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &RowValue_Date{int64(x)}
		return true, err
	case 5: // value.date_of_time
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &RowValue_DateOfTime{int64(x)}
		return true, err
	case 6: // value.time_of_day
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(TimeOfDay)
		err := b.DecodeMessage(msg)
		m.Value = &RowValue_TimeOfDay{msg}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:otsimo,项目名称:distribution,代码行数:50,代码来源:datasetmodels.pb.go

示例12: _HttpRule_OneofUnmarshaler

func _HttpRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*HttpRule)
	switch tag {
	case 2: // pattern.get
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Pattern = &HttpRule_Get{x}
		return true, err
	case 3: // pattern.put
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Pattern = &HttpRule_Put{x}
		return true, err
	case 4: // pattern.post
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Pattern = &HttpRule_Post{x}
		return true, err
	case 5: // pattern.delete
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Pattern = &HttpRule_Delete{x}
		return true, err
	case 6: // pattern.patch
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Pattern = &HttpRule_Patch{x}
		return true, err
	case 8: // pattern.custom
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(CustomHttpPattern)
		err := b.DecodeMessage(msg)
		m.Pattern = &HttpRule_Custom{msg}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:peter-edge,项目名称:protoeasy-go,代码行数:50,代码来源:http.pb.go

示例13: _OptionValue_OneofUnmarshaler

func _OptionValue_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*OptionValue)
	switch tag {
	case 2: // value.boolValue
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &OptionValue_BoolValue{x != 0}
		return true, err
	case 3: // value.intValue
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &OptionValue_IntValue{int64(x)}
		return true, err
	case 4: // value.doubleValue
		if wire != proto.WireFixed64 {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeFixed64()
		m.Value = &OptionValue_DoubleValue{math.Float64frombits(x)}
		return true, err
	case 5: // value.stringValue
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Value = &OptionValue_StringValue{x}
		return true, err
	case 6: // value.durationValue
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Value = &OptionValue_DurationValue{int64(x)}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:wutaizeng,项目名称:kapacitor,代码行数:42,代码来源:udf.pb.go

示例14: _Test_OneofUnmarshaler

func _Test_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Test)
	switch tag {
	case 6: // union.number
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.Union = &Test_Number{int32(x)}
		return true, err
	case 7: // union.name
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.Union = &Test_Name{x}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:aresetian,项目名称:golangservicetest,代码行数:21,代码来源:protoexample.pb.go

示例15: _Key_PathElement_OneofUnmarshaler

func _Key_PathElement_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Key_PathElement)
	switch tag {
	case 2: // id_type.id
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.IdType = &Key_PathElement_Id{int64(x)}
		return true, err
	case 3: // id_type.name
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeStringBytes()
		m.IdType = &Key_PathElement_Name{x}
		return true, err
	default:
		return false, nil
	}
}
开发者ID:go-microservices,项目名称:resizer,代码行数:21,代码来源:entity.pb.go


注:本文中的github.com/golang/protobuf/proto.Buffer.DecodeStringBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。