本文整理匯總了Golang中github.com/nildev/account/Godeps/_workspace/src/github.com/golang/protobuf/proto.Buffer.DecodeVarint方法的典型用法代碼示例。如果您正苦於以下問題:Golang Buffer.DecodeVarint方法的具體用法?Golang Buffer.DecodeVarint怎麽用?Golang Buffer.DecodeVarint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/nildev/account/Godeps/_workspace/src/github.com/golang/protobuf/proto.Buffer
的用法示例。
在下文中一共展示了Buffer.DecodeVarint方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: _ReadRowsResponse_Chunk_OneofUnmarshaler
func _ReadRowsResponse_Chunk_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*ReadRowsResponse_Chunk)
switch tag {
case 1: // chunk.row_contents
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(google_bigtable_v11.Family)
err := b.DecodeMessage(msg)
m.Chunk = &ReadRowsResponse_Chunk_RowContents{msg}
return true, err
case 2: // chunk.reset_row
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Chunk = &ReadRowsResponse_Chunk_ResetRow{x != 0}
return true, err
case 3: // chunk.commit_row
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Chunk = &ReadRowsResponse_Chunk_CommitRow{x != 0}
return true, err
default:
return false, nil
}
}
示例2: _GcRule_OneofUnmarshaler
func _GcRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*GcRule)
switch tag {
case 1: // rule.max_num_versions
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Rule = &GcRule_MaxNumVersions{int32(x)}
return true, err
case 2: // rule.max_age
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(google_protobuf.Duration)
err := b.DecodeMessage(msg)
m.Rule = &GcRule_MaxAge{msg}
return true, err
case 3: // rule.intersection
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(GcRule_Intersection)
err := b.DecodeMessage(msg)
m.Rule = &GcRule_Intersection_{msg}
return true, err
case 4: // rule.union
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(GcRule_Union)
err := b.DecodeMessage(msg)
m.Rule = &GcRule_Union_{msg}
return true, err
default:
return false, nil
}
}