returns the string read as a bytes slice, whether the value is NULL, the number of bytes read and an error, in case the string is longer than the input slice
(b []byte)
| 528 | // the number of bytes read and an error, in case the string is longer than |
| 529 | // the input slice |
| 530 | func readLengthEncodedString(b []byte) ([]byte, bool, int, error) { |
| 531 | // Get length |
| 532 | num, isNull, n := readLengthEncodedInteger(b) |
| 533 | if num < 1 { |
| 534 | return b[n:n], isNull, n, nil |
| 535 | } |
| 536 | |
| 537 | n += int(num) |
| 538 | |
| 539 | // Check data length |
| 540 | if len(b) >= n { |
| 541 | return b[n-int(num) : n : n], false, n, nil |
| 542 | } |
| 543 | return nil, false, n, io.EOF |
| 544 | } |
| 545 | |
| 546 | // returns the number of bytes skipped and an error, in case the string is |
| 547 | // longer than the input slice |
no test coverage detected