Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MainCommand = &cobra.Command{ Use: "avro-generator", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { if *f.outputFile == "." { *f.outputFile = fmt.Sprintf("%s.avsc", args[0]) } sourceTypePackage := *f.pkg sourceTypeName := args[0] pkg, err := loadPackage(sourceTypePackage) if err != nil { return err } obj := pkg.Types.Scope().Lookup(sourceTypeName) if obj == nil { return fmt.Errorf("%s not found in declared types of %s", sourceTypeName, pkg) } if _, ok := obj.(*types.TypeName); !ok { return fmt.Errorf("%v is not a named type", obj) } err = ioutil.WriteFile(*f.outputFile, []byte(avrotypes.ASTNodeToAvro(obj.Name(), obj.Type().Underlying())), os.ModePerm) return err }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.