本文整理汇总了Golang中github.com/tinylib/msgp/msgp.Writer.WriteFloat64方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.WriteFloat64方法的具体用法?Golang Writer.WriteFloat64怎么用?Golang Writer.WriteFloat64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tinylib/msgp/msgp.Writer
的用法示例。
在下文中一共展示了Writer.WriteFloat64方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z Person) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 3
// write "Name"
err = en.Append(0x83, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.Name)
if err != nil {
return
}
// write "Age"
err = en.Append(0xa3, 0x41, 0x67, 0x65)
if err != nil {
return err
}
err = en.WriteUint8(z.Age)
if err != nil {
return
}
// write "Height"
err = en.Append(0xa6, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74)
if err != nil {
return err
}
err = en.WriteFloat64(z.Height)
if err != nil {
return
}
return
}
示例2: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *CacheRegistry) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 6
// write "CacheKey"
err = en.Append(0x86, 0xa8, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4b, 0x65, 0x79)
if err != nil {
return err
}
err = en.WriteString(z.CacheKey)
if err != nil {
return
}
// write "Payload"
err = en.Append(0xa7, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64)
if err != nil {
return err
}
err = en.WriteIntf(z.Payload)
if err != nil {
return
}
// write "StoreTTL"
err = en.Append(0xa8, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x54, 0x54, 0x4c)
if err != nil {
return err
}
err = en.WriteFloat64(z.StoreTTL)
if err != nil {
return
}
// write "CacheTime"
err = en.Append(0xa9, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65)
if err != nil {
return err
}
err = en.WriteTime(z.CacheTime)
if err != nil {
return
}
// write "HasValue"
err = en.Append(0xa8, 0x48, 0x61, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65)
if err != nil {
return err
}
err = en.WriteBool(z.HasValue)
if err != nil {
return
}
// write "TypeName"
err = en.Append(0xa8, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.TypeName)
if err != nil {
return
}
return
}
示例3: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *Event) EncodeMsg(en *msgp.Writer) (err error) {
err = en.WriteMapHeader(5)
if err != nil {
return
}
err = en.WriteString("host")
if err != nil {
return
}
err = en.WriteString(z.Host)
if err != nil {
return
}
err = en.WriteString("service")
if err != nil {
return
}
err = en.WriteString(z.Service)
if err != nil {
return
}
err = en.WriteString("sub_service")
if err != nil {
return
}
err = en.WriteString(z.SubService)
if err != nil {
return
}
err = en.WriteString("metric")
if err != nil {
return
}
err = en.WriteFloat64(z.Metric)
if err != nil {
return
}
err = en.WriteString("tags")
if err != nil {
return
}
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
}
示例4: 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
}
示例5: EncodeMsg
// EncodeMsg implements msgp.Encodable
func (z *MetricData) EncodeMsg(en *msgp.Writer) (err error) {
// map header, size 9
// write "OrgId"
err = en.Append(0x89, 0xa5, 0x4f, 0x72, 0x67, 0x49, 0x64)
if err != nil {
return err
}
err = en.WriteInt(z.OrgId)
if err != nil {
return
}
// write "Name"
err = en.Append(0xa4, 0x4e, 0x61, 0x6d, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.Name)
if err != nil {
return
}
// write "Metric"
err = en.Append(0xa6, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63)
if err != nil {
return err
}
err = en.WriteString(z.Metric)
if err != nil {
return
}
// write "Interval"
err = en.Append(0xa8, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c)
if err != nil {
return err
}
err = en.WriteInt(z.Interval)
if err != nil {
return
}
// write "Value"
err = en.Append(0xa5, 0x56, 0x61, 0x6c, 0x75, 0x65)
if err != nil {
return err
}
err = en.WriteFloat64(z.Value)
if err != nil {
return
}
// write "Unit"
err = en.Append(0xa4, 0x55, 0x6e, 0x69, 0x74)
if err != nil {
return err
}
err = en.WriteString(z.Unit)
if err != nil {
return
}
// write "Time"
err = en.Append(0xa4, 0x54, 0x69, 0x6d, 0x65)
if err != nil {
return err
}
err = en.WriteInt64(z.Time)
if err != nil {
return
}
// write "TargetType"
err = en.Append(0xaa, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65)
if err != nil {
return err
}
err = en.WriteString(z.TargetType)
if err != nil {
return
}
// write "Tags"
err = en.Append(0xa4, 0x54, 0x61, 0x67, 0x73)
if err != nil {
return err
}
err = en.WriteArrayHeader(uint32(len(z.Tags)))
if err != nil {
return
}
for xvk := range z.Tags {
err = en.WriteString(z.Tags[xvk])
if err != nil {
return
}
}
return
}