github.com/aacfactory/avro@v1.2.12/internal/base/schema_map.go (about) 1 package base 2 3 import ( 4 "fmt" 5 "github.com/modern-go/reflect2" 6 "reflect" 7 ) 8 9 func parseMapType(typ reflect2.Type) (s Schema, err error) { 10 mapType := typ.(reflect2.MapType) 11 if mapType.Key().Kind() != reflect.String { 12 err = fmt.Errorf("key of map must be string") 13 return 14 } 15 elemSchema, elemErr := parseValueType(mapType.Elem()) 16 if elemErr != nil { 17 err = elemErr 18 return 19 } 20 s = NewMapSchema(elemSchema) 21 return 22 }