MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / BytesNext

Function BytesNext

pkg/sql/sem/tree/datum.go:1141–1154  ·  view source on GitHub ↗

BytesNext returns the next possible byte slice, using the extra capacity of the provided slice if possible, and if not, appending an \x00.

(b []byte)

Source from the content-addressed store, hash-verified

1139// BytesNext returns the next possible byte slice, using the extra capacity
1140// of the provided slice if possible, and if not, appending an \x00.
1141func BytesNext(b []byte) []byte {
1142 if cap(b) > len(b) {
1143 bNext := b[:len(b)+1]
1144 if bNext[len(bNext)-1] == 0 {
1145 return bNext
1146 }
1147 }
1148 // TODO(spencer): Do we need to enforce KeyMaxLength here?
1149 // Switched to "make and copy" pattern in #4963 for performance.
1150 bn := make([]byte, len(b)+1)
1151 copy(bn, b)
1152 bn[len(bn)-1] = 0
1153 return bn
1154}
1155
1156func bytesPrefixEnd(b []byte) []byte {
1157 // Switched to "make and copy" pattern in #4963 for performance.

Callers 1

NextMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…