LengthEncodedString 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)
| 194 | // the number of bytes read and an error, in case the string is longer than |
| 195 | // the input slice |
| 196 | func LengthEncodedString(b []byte) ([]byte, bool, int, error) { |
| 197 | // Get length |
| 198 | num, isNull, n := LengthEncodedInt(b) |
| 199 | if num < 1 { |
| 200 | return b[n:n], isNull, n, nil |
| 201 | } |
| 202 | |
| 203 | n += int(num) |
| 204 | |
| 205 | // Check data length |
| 206 | if len(b) >= n { |
| 207 | return b[n-int(num) : n : n], false, n, nil |
| 208 | } |
| 209 | return nil, false, n, io.EOF |
| 210 | } |
| 211 | |
| 212 | func SkipLengthEncodedString(b []byte) (int, error) { |
| 213 | // Get length |
no test coverage detected