当前位置: 首页>>代码示例>>Golang>>正文


Golang bytes2.ChunkedWriter类代码示例

本文整理汇总了Golang中github.com/corestoreio/csfw/util/sqlparser/dependency/bytes2.ChunkedWriter的典型用法代码示例。如果您正苦于以下问题:Golang ChunkedWriter类的具体用法?Golang ChunkedWriter怎么用?Golang ChunkedWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ChunkedWriter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: EncodeString

// EncodeString encodes a string.
func EncodeString(buf *bytes2.ChunkedWriter, key string, val string) {
	// Encode strings as binary; go strings are not necessarily unicode
	EncodePrefix(buf, Binary, key)
	putUint32(buf, uint32(len(val)))
	buf.WriteByte(0)
	buf.WriteString(val)
}
开发者ID:joao-parana,项目名称:csfw,代码行数:8,代码来源:marshal.go

示例2: EncodeBool

// EncodeBool encodes a bool.
func EncodeBool(buf *bytes2.ChunkedWriter, key string, val bool) {
	EncodePrefix(buf, Boolean, key)
	if val {
		buf.WriteByte(1)
	} else {
		buf.WriteByte(0)
	}
}
开发者ID:joao-parana,项目名称:csfw,代码行数:9,代码来源:marshal.go

示例3: putUint64

func putUint64(buf *bytes2.ChunkedWriter, val uint64) {
	Pack.PutUint64(buf.Reserve(WORD64), val)
}
开发者ID:joao-parana,项目名称:csfw,代码行数:3,代码来源:marshal.go

示例4: putUint32

func putUint32(buf *bytes2.ChunkedWriter, val uint32) {
	Pack.PutUint32(buf.Reserve(WORD32), val)
}
开发者ID:joao-parana,项目名称:csfw,代码行数:3,代码来源:marshal.go

示例5: 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}
}
开发者ID:joao-parana,项目名称:csfw,代码行数:7,代码来源:marshal.go

示例6: EncodeBinary

// EncodeBinary encodes a []byte as binary.
func EncodeBinary(buf *bytes2.ChunkedWriter, key string, val []byte) {
	EncodePrefix(buf, Binary, key)
	putUint32(buf, uint32(len(val)))
	buf.WriteByte(0)
	buf.Write(val)
}
开发者ID:joao-parana,项目名称:csfw,代码行数:7,代码来源:marshal.go

示例7: 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
}
开发者ID:joao-parana,项目名称:csfw,代码行数:7,代码来源:marshal.go


注:本文中的github.com/corestoreio/csfw/util/sqlparser/dependency/bytes2.ChunkedWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。