Skip to content

Commit 32fb382

Browse files
committed
utils: document return values
1 parent fa25de3 commit 32fb382

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

utils.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@ func stringToInt(b []byte) int {
600600
return val
601601
}
602602

603+
// returns the string read as a bytes slice, wheter the value is NULL,
604+
// the number of bytes read and an error, in case the string is longer than
605+
// the input slice
603606
func readLengthEnodedString(b []byte) ([]byte, bool, int, error) {
604607
// Get length
605608
num, isNull, n := readLengthEncodedInteger(b)
@@ -616,6 +619,8 @@ func readLengthEnodedString(b []byte) ([]byte, bool, int, error) {
616619
return nil, false, n, io.EOF
617620
}
618621

622+
// returns the number of bytes skipped and an error, in case the string is
623+
// longer than the input slice
619624
func skipLengthEnodedString(b []byte) (int, error) {
620625
// Get length
621626
num, _, n := readLengthEncodedInteger(b)
@@ -632,6 +637,7 @@ func skipLengthEnodedString(b []byte) (int, error) {
632637
return n, io.EOF
633638
}
634639

640+
// returns the number read, whether the value is NULL and the number of bytes read
635641
func readLengthEncodedInteger(b []byte) (uint64, bool, int) {
636642
switch b[0] {
637643

@@ -659,6 +665,7 @@ func readLengthEncodedInteger(b []byte) (uint64, bool, int) {
659665
return uint64(b[0]), false, 1
660666
}
661667

668+
// encodes a uint64 value and appends it to the given bytes slice
662669
func appendLengthEncodedInteger(b []byte, n uint64) []byte {
663670
switch {
664671
case n <= 250:

0 commit comments

Comments
 (0)