本文整理匯總了Golang中github.com/housinganywhere/pg/internal/pool.Buffer.WriteString方法的典型用法代碼示例。如果您正苦於以下問題:Golang Buffer.WriteString方法的具體用法?Golang Buffer.WriteString怎麽用?Golang Buffer.WriteString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/housinganywhere/pg/internal/pool.Buffer
的用法示例。
在下文中一共展示了Buffer.WriteString方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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()
}
示例2: 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
}
示例3: 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()
}
示例4: writePasswordMsg
func writePasswordMsg(buf *pool.Buffer, password string) {
buf.StartMessage(passwordMessageMsg)
buf.WriteString(password)
buf.FinishMessage()
}