本文整理匯總了Golang中github.com/henryanand/vitess/go/bytes2.ChunkedWriter.Reserve方法的典型用法代碼示例。如果您正苦於以下問題:Golang ChunkedWriter.Reserve方法的具體用法?Golang ChunkedWriter.Reserve怎麽用?Golang ChunkedWriter.Reserve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/henryanand/vitess/go/bytes2.ChunkedWriter
的用法示例。
在下文中一共展示了ChunkedWriter.Reserve方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: putUint64
func putUint64(buf *bytes2.ChunkedWriter, val uint64) {
Pack.PutUint64(buf.Reserve(WORD64), val)
}
示例2: NewLenWriter
// NewLenWriter returns a LenWriter that reserves the
// bytes buf so they can store the length later.
func NewLenWriter(buf *bytes2.ChunkedWriter) LenWriter {
off := buf.Len()
b := buf.Reserve(WORD32)
return LenWriter{buf, off, b}
}
示例3: putUint32
func putUint32(buf *bytes2.ChunkedWriter, val uint32) {
Pack.PutUint32(buf.Reserve(WORD32), val)
}
示例4: EncodePrefix
// EncodePrefix encodes key as prefix for the next object or value.
func EncodePrefix(buf *bytes2.ChunkedWriter, etype byte, key string) {
b := buf.Reserve(len(key) + 2)
b[0] = etype
copy(b[1:], key)
b[len(b)-1] = 0
}