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

Function DecodeRawBytesToByteArrayAuto

pkg/sql/lex/encode.go:214–219  ·  view source on GitHub ↗

DecodeRawBytesToByteArrayAuto detects which format to use with DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix) and escape.

(data []byte)

Source from the content-addressed store, hash-verified

212// DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix)
213// and escape.
214func DecodeRawBytesToByteArrayAuto(data []byte) ([]byte, error) {
215 if len(data) >= 2 && data[0] == '\\' && (data[1] == 'x' || data[1] == 'X') {
216 return DecodeRawBytesToByteArray(data[2:], BytesEncodeHex)
217 }
218 return DecodeRawBytesToByteArray(data, BytesEncodeEscape)
219}
220
221func (f BytesEncodeFormat) String() string {
222 switch f {

Callers 2

ParseDByteFunction · 0.92

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…