本文整理匯總了Golang中github.com/funny-falcon/go-iproto/marshal.Writer.Int64方法的典型用法代碼示例。如果您正苦於以下問題:Golang Writer.Int64方法的具體用法?Golang Writer.Int64怎麽用?Golang Writer.Int64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/funny-falcon/go-iproto/marshal.Writer
的用法示例。
在下文中一共展示了Writer.Int64方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: IWrite
func (o Op) IWrite(w *marshal.Writer) {
w.Write(o.Field)
if o.Op <= 7 {
w.Write(o.Op)
} else {
w.Write(opmap[o.Op])
}
switch v := o.Val.(type) {
case uint32:
w.Int8(4)
w.Uint32(v)
case uint64:
w.Int8(8)
w.Uint64(v)
case int32:
w.Int8(4)
w.Int32(v)
case int64:
w.Int8(8)
w.Int64(v)
case []byte:
w.Intvar(len(v))
w.Bytes(v)
case string:
w.Intvar(len(v))
w.String(v)
default:
val := reflect.ValueOf(v)
wr := marshal.WriterFor(val.Type())
wr.WithSize(w, val, (*marshal.Writer).Intvar)
}
}
示例2: 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
}