本文整理汇总了Golang中github.com/tinylib/msgp/msgp.Writer类的典型用法代码示例。如果您正苦于以下问题:Golang Writer类的具体用法?Golang Writer怎么用?Golang Writer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Writer类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *bitmapContainer) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 2
// write "cardinality"
err = en.Append(0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
if err != nil {
return err
}
err = en.WriteInt(z.cardinality)
if err != nil {
return
}
// write "bitmap"
err = en.Append(0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
if err != nil {
return err
}
err = en.WriteArrayHeader(uint32(len(z.bitmap)))
if err != nil {
return
}
for zxvk := range z.bitmap {
err = en.WriteUint64(z.bitmap[zxvk])
if err != nil {
return
}
}
return
}
开发者ID:RoaringBitmap,项目名称:roaring,代码行数:29,代码来源:bitmapcontainer_gen.go
示例2: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z contype) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteUint8(uint8(z))
if err != nil {
return
}
return
}
开发者ID:RoaringBitmap,项目名称:roaring,代码行数:8,代码来源:roaringarray_gen.go
示例3: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z Ztype) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteInt32(int32(z))
if err != nil {
return
}
return
}
开发者ID:glycerine,项目名称:zebra,代码行数:8,代码来源:zebra_gen.go
示例4: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z DocumentID) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteUint(uint(z))
if err != nil {
return
}
return
}
开发者ID:JustinAzoff,项目名称:flow-indexer,代码行数:8,代码来源:documentlist_msgp_gen.go
示例5: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z Binary) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteBytes([]byte(z))
if err != nil {
return
}
return
}
开发者ID:tartavull,项目名称:dvid,代码行数:8,代码来源:msgpack_gen.go
示例6: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z uint32Slice) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteArrayHeader(uint32(len(z)))
if err != nil {
return
}
for zzpf := range z {
err = en.WriteUint32(z[zzpf])
if err != nil {
return
}
}
return
}
开发者ID:RoaringBitmap,项目名称:roaring,代码行数:14,代码来源:rle_gen.go
示例7: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z Error) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 1
// write "msg"
err = en.Append(0x81, 0xa3, 0x6d, 0x73, 0x67)
if err != nil {
return err
}
err = en.WriteString(z.Msg)
if err != nil {
return
}
return
}
开发者ID:sztanpet,项目名称:bimpc,代码行数:14,代码来源:mpc_gen.go
示例8: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z MetricDataArray) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteArrayHeader(uint32(len(z)))
if err != nil {
return
}
for cmr := range z {
if z[cmr] == nil {
err = en.WriteNil()
if err != nil {
return
}
} else {
err = z[cmr].EncodeMsg(en)
if err != nil {
return
}
}
}
return
}
开发者ID:aglagla,项目名称:raintank-metric,代码行数:21,代码来源:metric_gen.go
示例9: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *Message) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteArrayHeader(4)
if err != nil {
return
}
err = en.WriteString(z.Tag)
if err != nil {
return
}
err = en.WriteInt64(z.Time)
if err != nil {
return
}
err = en.WriteIntf(z.Record)
if err != nil {
return
}
err = en.WriteIntf(z.Option)
if err != nil {
return
}
return
}
开发者ID:CadeLaRen,项目名称:docker-3,代码行数:24,代码来源:proto_gen.go
示例10: EncodeMsg
// EncodeMsg encodes the notification to writer. The body is expected to
// be an encodable type.
func (n *Notification) EncodeMsg(w *msgp.Writer) error {
var bm msgp.Encodable
if n.Body != nil {
var ok bool
bm, ok = n.Body.(msgp.Encodable)
if !ok {
return ErrNotEncodable
}
}
var err error
if err = w.WriteArrayHeader(NotificationPackSize); err != nil {
return err
}
if err = w.WriteInt(NotificationType); err != nil {
return err
}
if err = w.WriteString(n.Method); err != nil {
return err
}
// No body to encode. Write a zero-length params array.
if bm == nil {
return w.WriteArrayHeader(0)
}
// 1-item array containing the body.
if err = w.WriteArrayHeader(1); err != nil {
return err
}
return msgp.Encode(w, bm)
}
开发者ID:micro,项目名称:go-plugins,代码行数:39,代码来源:rpc.go
示例11: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z Incoming) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 2
// write "from"
err = en.Append(0x82, 0xa4, 0x66, 0x72, 0x6f, 0x6d)
if err != nil {
return err
}
err = en.WriteString(z.From)
if err != nil {
return
}
// write "message"
err = en.Append(0xa7, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.Message)
if err != nil {
return
}
return
}
开发者ID:sztanpet,项目名称:bimpc,代码行数:23,代码来源:main_gen.go
示例12: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z Foo) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 2
// write "bar"
err = en.Append(0x82, 0xa3, 0x62, 0x61, 0x72)
if err != nil {
return err
}
err = en.WriteString(z.Bar)
if err != nil {
return
}
// write "baz"
err = en.Append(0xa3, 0x62, 0x61, 0x7a)
if err != nil {
return err
}
err = en.WriteFloat64(z.Baz)
if err != nil {
return
}
return
}
开发者ID:zchee,项目名称:go-sandbox,代码行数:23,代码来源:main_gen.go
示例13: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z Person) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 2
// write "first"
err = en.Append(0x82, 0xa5, 0x66, 0x69, 0x72, 0x73, 0x74)
if err != nil {
return err
}
err = en.WriteString(z.First)
if err != nil {
return
}
// write "last"
err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74)
if err != nil {
return err
}
err = en.WriteString(z.Last)
if err != nil {
return
}
return
}
开发者ID:glycerine,项目名称:zygomys,代码行数:23,代码来源:demo_go_structs_gen.go
示例14: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *arrayContainer) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 1
// write "content"
err = en.Append(0x81, 0xa7, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74)
if err != nil {
return err
}
err = en.WriteArrayHeader(uint32(len(z.content)))
if err != nil {
return
}
for zxvk := range z.content {
err = en.WriteUint16(z.content[zxvk])
if err != nil {
return
}
}
return
}
开发者ID:RoaringBitmap,项目名称:roaring,代码行数:20,代码来源:arraycontainer_gen.go
示例15: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *ProbeEvent) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 8
// write "Id"
err = en.Append(0x88, 0xa2, 0x49, 0x64)
if err != nil {
return err
}
err = en.WriteString(z.Id)
if err != nil {
return
}
// write "EventType"
err = en.Append(0xa9, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.EventType)
if err != nil {
return
}
// write "OrgId"
err = en.Append(0xa5, 0x4f, 0x72, 0x67, 0x49, 0x64)
if err != nil {
return err
}
err = en.WriteInt64(z.OrgId)
if err != nil {
return
}
// write "Severity"
err = en.Append(0xa8, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79)
if err != nil {
return err
}
err = en.WriteString(z.Severity)
if err != nil {
return
}
// write "Source"
err = en.Append(0xa6, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.Source)
if err != nil {
return
}
// write "Timestamp"
err = en.Append(0xa9, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70)
if err != nil {
return err
}
err = en.WriteInt64(z.Timestamp)
if err != nil {
return
}
// write "Message"
err = en.Append(0xa7, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.Message)
if err != nil {
return
}
// write "Tags"
err = en.Append(0xa4, 0x54, 0x61, 0x67, 0x73)
if err != nil {
return err
}
err = en.WriteMapHeader(uint32(len(z.Tags)))
if err != nil {
return
}
for xvk, bzg := range z.Tags {
err = en.WriteString(xvk)
if err != nil {
return
}
err = en.WriteString(bzg)
if err != nil {
return
}
}
return
}
开发者ID:graphite-ng,项目名称:carbon-relay-ng,代码行数:87,代码来源:event_gen.go
示例16: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *A) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 6
// write "Name"
err = en.Append(0x86, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.Name)
if err != nil {
return
}
// write "BirthDay"
err = en.Append(0xa8, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x79)
if err != nil {
return err
}
err = en.WriteInt64(z.BirthDay)
if err != nil {
return
}
// write "Phone"
err = en.Append(0xa5, 0x50, 0x68, 0x6f, 0x6e, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.Phone)
if err != nil {
return
}
// write "Siblings"
err = en.Append(0xa8, 0x53, 0x69, 0x62, 0x6c, 0x69, 0x6e, 0x67, 0x73)
if err != nil {
return err
}
err = en.WriteInt64(z.Siblings)
if err != nil {
return
}
// write "Spouse"
err = en.Append(0xa6, 0x53, 0x70, 0x6f, 0x75, 0x73, 0x65)
if err != nil {
return err
}
err = en.WriteUint8(z.Spouse)
if err != nil {
return
}
// write "Money"
err = en.Append(0xa5, 0x4d, 0x6f, 0x6e, 0x65, 0x79)
if err != nil {
return err
}
err = en.WriteFloat64(z.Money)
if err != nil {
return
}
return
}
开发者ID:andyleap,项目名称:gencode,代码行数:59,代码来源:test.schema.gen_gen.go
示例17: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *Packet) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 4
// write "type"
err = en.Append(0x84, 0xa4, 0x74, 0x79, 0x70, 0x65)
if err != nil {
return err
}
err = en.WriteByte(z.pType)
if err != nil {
return
}
// write "id"
err = en.Append(0xa2, 0x69, 0x64)
if err != nil {
return err
}
err = en.WriteInt(z.id)
if err != nil {
return
}
// write "event"
err = en.Append(0xa5, 0x65, 0x76, 0x65, 0x6e, 0x74)
if err != nil {
return err
}
err = en.WriteString(z.eventName)
if err != nil {
return
}
// write "payload"
err = en.Append(0xa7, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64)
if err != nil {
return err
}
err = en.WriteBytes(z.payload)
if err != nil {
return
}
return
}
开发者ID:ZloyDyadka,项目名称:socketcrutch,代码行数:41,代码来源:packet_gen.go
注:本文中的github.com/tinylib/msgp/msgp.Writer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论