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

Function UndoPrefixEnd

pkg/util/encoding/encoding.go:1686–1694  ·  view source on GitHub ↗

UndoPrefixEnd is a partial inverse for roachpb.Key.PrefixEnd. In general, we can't undo PrefixEnd because it is lossy; we don't know how many FFs were stripped from the original key. For example: - key: 01 02 03 FF FF - PrefixEnd: 01 02 04 - UndoPrefixEnd: 01 02 03 Some keys are n

(b []byte)

Source from the content-addressed store, hash-verified

1684// UndoPrefixEnd is implemented here to avoid a circular dependency on roachpb,
1685// but arguably belongs in a byte-manipulation utility package.
1686func UndoPrefixEnd(b []byte) (_ []byte, ok bool) {
1687 if len(b) == 0 || b[len(b)-1] == 0 {
1688 // Not a possible result of PrefixEnd.
1689 return nil, false
1690 }
1691 out := append([]byte(nil), b...)
1692 out[len(out)-1]--
1693 return out, true
1694}
1695
1696// NonsortingVarintMaxLen is the maximum length of an EncodeNonsortingVarint
1697// encoded value.

Callers 1

PrettyPrintValueFunction · 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…