當前位置: 首頁>>代碼示例>>Golang>>正文


Golang pool.Buffer類代碼示例

本文整理匯總了Golang中github.com/housinganywhere/pg/internal/pool.Buffer的典型用法代碼示例。如果您正苦於以下問題:Golang Buffer類的具體用法?Golang Buffer怎麽用?Golang Buffer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Buffer類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: writeCancelRequestMsg

func writeCancelRequestMsg(buf *pool.Buffer, processId, secretKey int32) {
	buf.StartMessage(0)
	buf.WriteInt32(80877102)
	buf.WriteInt32(processId)
	buf.WriteInt32(secretKey)
	buf.FinishMessage()
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:7,代碼來源:messages.go

示例2: writeQueryMsg

func writeQueryMsg(buf *pool.Buffer, query interface{}, params ...interface{}) error {
	buf.StartMessage(queryMsg)
	bytes, err := orm.AppendQuery(buf.Bytes, query, params...)
	if err != nil {
		buf.Reset()
		return err
	}
	buf.Bytes = bytes
	buf.WriteByte(0x0)
	buf.FinishMessage()
	return nil
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:12,代碼來源:messages.go

示例3: writeCopyDone

func writeCopyDone(buf *pool.Buffer) {
	buf.StartMessage(copyDoneMsg)
	buf.FinishMessage()
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:4,代碼來源:messages.go

示例4: writeCopyData

func writeCopyData(buf *pool.Buffer, r io.Reader) (int64, error) {
	buf.StartMessage(copyDataMsg)
	n, err := buf.ReadFrom(r)
	buf.FinishMessage()
	return n, err
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:6,代碼來源:messages.go

示例5: writeBindExecuteMsg

// Writes BIND, EXECUTE and SYNC messages.
func writeBindExecuteMsg(buf *pool.Buffer, name string, params ...interface{}) error {
	const paramLenWidth = 4

	buf.StartMessage(bindMsg)
	buf.WriteString("")
	buf.WriteString(name)
	buf.WriteInt16(0)
	buf.WriteInt16(int16(len(params)))
	for _, param := range params {
		buf.StartParam()
		bytes := types.Append(buf.Bytes, param, false)
		if bytes != nil {
			buf.Bytes = bytes
			buf.FinishParam()
		} else {
			buf.FinishNullParam()
		}
	}
	buf.WriteInt16(0)
	buf.FinishMessage()

	buf.StartMessage(executeMsg)
	buf.WriteString("")
	buf.WriteInt32(0)
	buf.FinishMessage()

	buf.StartMessage(syncMsg)
	buf.FinishMessage()

	return nil
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:32,代碼來源:messages.go

示例6: writeParseDescribeSyncMsg

func writeParseDescribeSyncMsg(buf *pool.Buffer, name, q string) {
	buf.StartMessage(parseMsg)
	buf.WriteString(name)
	buf.WriteString(q)
	buf.WriteInt16(0)
	buf.FinishMessage()

	buf.StartMessage(describeMsg)
	buf.WriteByte('S')
	buf.WriteString(name)
	buf.FinishMessage()

	buf.StartMessage(syncMsg)
	buf.FinishMessage()
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:15,代碼來源:messages.go

示例7: writePasswordMsg

func writePasswordMsg(buf *pool.Buffer, password string) {
	buf.StartMessage(passwordMessageMsg)
	buf.WriteString(password)
	buf.FinishMessage()
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:5,代碼來源:messages.go

示例8: writeSSLMsg

func writeSSLMsg(buf *pool.Buffer) {
	buf.StartMessage(0)
	buf.WriteInt32(80877103)
	buf.FinishMessage()
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:5,代碼來源:messages.go

示例9: writeStartupMsg

func writeStartupMsg(buf *pool.Buffer, user, database string) {
	buf.StartMessage(0)
	buf.WriteInt32(196608)
	buf.WriteString("user")
	buf.WriteString(user)
	buf.WriteString("database")
	buf.WriteString(database)
	buf.WriteString("")
	buf.FinishMessage()
}
開發者ID:housinganywhere,項目名稱:pg,代碼行數:10,代碼來源:messages.go


注:本文中的github.com/housinganywhere/pg/internal/pool.Buffer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。