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

Function PrettyPrintValue

pkg/util/encoding/encoding.go:1428–1449  ·  view source on GitHub ↗

PrettyPrintValue returns the string representation of all contiguous decodable values in the provided byte slice, separated by a provided separator. The directions each value is encoded may be provided. If valDirs is nil, all values are decoded and printed with the default direction (ascending).

(valDirs []Direction, b []byte, sep string)

Source from the content-addressed store, hash-verified

1426// The directions each value is encoded may be provided. If valDirs is nil,
1427// all values are decoded and printed with the default direction (ascending).
1428func PrettyPrintValue(valDirs []Direction, b []byte, sep string) string {
1429 s1, allDecoded := prettyPrintValueImpl(valDirs, b, sep)
1430 if allDecoded {
1431 return s1
1432 }
1433 if undoPrefixEnd, ok := UndoPrefixEnd(b); ok {
1434 // When we UndoPrefixEnd, we may have lost a tail of 0xFFs. Try to add
1435 // enough of them to get something decoded. This is best-effort, we have to stop
1436 // somewhere.
1437 cap := 20
1438 if len(valDirs) > len(b) {
1439 cap = len(valDirs) - len(b)
1440 }
1441 for i := 0; i < cap; i++ {
1442 if s2, allDecoded := prettyPrintValueImpl(valDirs, undoPrefixEnd, sep); allDecoded {
1443 return s2 + sep + "PrefixEnd"
1444 }
1445 undoPrefixEnd = append(undoPrefixEnd, 0xFF)
1446 }
1447 }
1448 return s1
1449}
1450
1451func prettyPrintValueImpl(valDirs []Direction, b []byte, sep string) (string, bool) {
1452 allDecoded := true

Callers

nothing calls this directly

Calls 2

prettyPrintValueImplFunction · 0.85
UndoPrefixEndFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…