本文整理汇总了Golang中github.com/funny-falcon/go-iproto/marshal.Writer.Uint8方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.Uint8方法的具体用法?Golang Writer.Uint8怎么用?Golang Writer.Uint8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/funny-falcon/go-iproto/marshal.Writer
的用法示例。
在下文中一共展示了Writer.Uint8方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: WriteTuple
func WriteTuple(w *marshal.Writer, i interface{}) {
switch o := i.(type) {
case nil:
return
case uint8:
w.Uint32(1)
w.Uint8(1)
w.Uint8(o)
case int8:
w.Uint32(1)
w.Uint8(1)
w.Int8(o)
case uint16:
w.Uint32(1)
w.Uint8(2)
w.Uint16(o)
case int16:
w.Uint32(1)
w.Uint8(2)
w.Int16(o)
case uint32:
w.Uint32(1)
w.Uint8(4)
w.Uint32(o)
case int32:
w.Uint32(1)
w.Uint8(4)
w.Int32(o)
case uint64:
w.Uint32(1)
w.Uint8(8)
w.Uint64(o)
case int64:
w.Uint32(1)
w.Uint8(8)
w.Int64(o)
case float32:
w.Uint32(1)
w.Uint8(4)
w.Float32(o)
case float64:
w.Uint32(1)
w.Uint8(8)
w.Float64(o)
case string:
w.Uint32(1)
w.Intvar(len(o))
w.String(o)
case []byte:
w.Uint32(1)
w.Intvar(len(o))
w.Bytes(o)
case []interface{}:
w.IntUint32(len(o))
for _, v := range o {
w.WriteWithSize(v, (*marshal.Writer).Intvar)
}
default:
val := reflect.ValueOf(i)
rt := val.Type()
wr := writer(rt)
wr.Write(w, val)
}
return
}