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

Function DecodeRawBytesToByteArrayAuto

pkg/sql/lex/encode.go:347–352  ·  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

345// DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix)
346// and escape.
347func DecodeRawBytesToByteArrayAuto(data []byte) ([]byte, error) {
348 if len(data) >= 2 && data[0] == '\\' && (data[1] == 'x' || data[1] == 'X') {
349 return DecodeRawBytesToByteArray(string(data[2:]), sessiondata.BytesEncodeHex)
350 }
351 return DecodeRawBytesToByteArray(string(data), sessiondata.BytesEncodeEscape)
352}

Callers 1

ParseDByteFunction · 0.92

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…