2
0

Update pgproto3 to enable pgmock

This commit is contained in:
Jack Christensen
2017-05-06 08:48:40 -05:00
parent d4fe3edf84
commit 6f398d8bb5
+11
View File
@@ -1,6 +1,7 @@
package pgio
import (
"bytes"
"encoding/binary"
)
@@ -38,3 +39,13 @@ func NextInt64(buf []byte) ([]byte, int64) {
buf, n := NextUint64(buf)
return buf, int64(n)
}
func NextCString(buf []byte) ([]byte, string, bool) {
idx := bytes.IndexByte(buf, 0)
if idx < 0 {
return buf, "", false
}
cstring := string(buf[:idx])
buf = buf[:idx+1]
return buf, cstring, true
}