DecodeRawBytesToByteArrayAuto detects which format to use with DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix) and escape.
(data []byte)
| 345 | // DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix) |
| 346 | // and escape. |
| 347 | func 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 | } |
no test coverage detected
searching dependent graphs…