github.com/aacfactory/avro@v1.2.12/internal/base/schema_slice.go (about)

     1  package base
     2  
     3  import (
     4  	"github.com/modern-go/reflect2"
     5  	"reflect"
     6  )
     7  
     8  func parseSliceType(typ reflect2.Type) (s Schema, err error) {
     9  	elemType := typ.(reflect2.SliceType).Elem()
    10  	if elemType.Kind() == reflect.Uint8 {
    11  		s = NewPrimitiveSchema(Bytes, nil)
    12  		return
    13  	}
    14  	elemSchema, elemErr := parseValueType(elemType)
    15  	if elemErr != nil {
    16  		err = elemErr
    17  		return
    18  	}
    19  	s = NewArraySchema(elemSchema)
    20  	return
    21  }