Skip to content

Commit

Permalink
doc: add isByteArryType annonation
Browse files Browse the repository at this point in the history
  • Loading branch information
gouhuan committed Apr 2, 2024
1 parent 71a939b commit f9c616c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ func isSliceOrArryType(t reflect.Kind) bool {
return t == reflect.Slice || t == reflect.Array
}

// isByteArrayType
// Check if the data is of slice or array type
// while simultaneously verifying if the element type is of byte type(in go defined "type byte=uint8").
func isByteArrayType(t reflect.Type) bool {
return (t.Kind() == reflect.Slice || t.Kind() == reflect.Array) &&
t.Elem().Kind() == reflect.Uint8
Expand Down

0 comments on commit f9c616c

Please sign in to comment.