MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / UnsafeConvertStringToBytes

Function UnsafeConvertStringToBytes

pkg/util/encoding/encoding.go:919–926  ·  view source on GitHub ↗

UnsafeConvertStringToBytes converts a string to a byte array to be used with string encoding functions. Note that the output byte array should not be modified if the input string is expected to be used again - doing so could violate Go semantics.

(s string)

Source from the content-addressed store, hash-verified

917// modified if the input string is expected to be used again - doing so could
918// violate Go semantics.
919func UnsafeConvertStringToBytes(s string) []byte {
920 // unsafe.StringData output is unspecified for empty string input so always
921 // return nil.
922 if len(s) == 0 {
923 return nil
924 }
925 return unsafe.Slice(unsafe.StringData(s), len(s))
926}
927
928// EncodeStringAscending encodes the string value using an escape-based encoding. See
929// EncodeBytes for details. The encoded bytes are append to the supplied buffer

Callers 11

ParseDByteFunction · 0.92
UnsafeBytesMethod · 0.92
UnsafeContentBytesMethod · 0.92
UnsafeBytesMethod · 0.92
UnsafeBytesMethod · 0.92
EncodeTSVectorFunction · 0.92
encodeTSNodeMethod · 0.92
EncodeStringDescendingFunction · 0.85

Calls 1

SliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…