ReadStringSlice reads []string from buffer using LIST protocol
(buf *ByteBuffer, err *Error)
| 1423 | |
| 1424 | // ReadStringSlice reads []string from buffer using LIST protocol |
| 1425 | func ReadStringSlice(buf *ByteBuffer, err *Error) []string { |
| 1426 | length := buf.ReadLength(err) |
| 1427 | if length == 0 { |
| 1428 | return make([]string, 0) |
| 1429 | } |
| 1430 | collectFlag := buf.ReadInt8(err) |
| 1431 | if (collectFlag&CollectionIsSameType) != 0 && (collectFlag&CollectionIsDeclElementType) == 0 { |
| 1432 | _ = buf.ReadUint8(err) // Read and discard element type ID |
| 1433 | } |
| 1434 | if err.HasError() || !buf.CheckReadable(length, err) { |
| 1435 | return nil |
| 1436 | } |
| 1437 | result := make([]string, length) |
| 1438 | trackRefs := (collectFlag & CollectionTrackingRef) != 0 |
| 1439 | hasNull := (collectFlag & CollectionHasNull) != 0 |
| 1440 | for i := 0; i < length; i++ { |
| 1441 | if trackRefs || hasNull { |
| 1442 | rf := buf.ReadInt8(err) |
| 1443 | if rf == NullFlag { |
| 1444 | continue |
| 1445 | } |
| 1446 | } |
| 1447 | result[i] = readString(buf, err) |
| 1448 | } |
| 1449 | return result |
| 1450 | } |
| 1451 | |
| 1452 | // ============================================================================ |
| 1453 | // bfloat16SliceSerializer - optimized []bfloat16.BFloat16 serialization |
no test coverage detected