-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined: avrotypegen #130
Comments
code generated // Code generated by avrogen. DO NOT EDIT.
package is
import (
"fmt"
"strconv"
)
type ItemEvent struct {
Id string `json:"id"`
Modes []Mode `json:"modes"`
}
// AvroRecord implements the avro.AvroRecord interface.
func (ItemEvent) AvroRecord() avrotypegen.RecordInfo {
return avrotypegen.RecordInfo{
Schema: `{"fields":[{"name":"id","type":{"logicalType":"UUID","type":"string"}},{"name":"modes","type":{"items":{"name":"mode","symbols":["SINGULAR"],"type":"enum"},"type":"array"}}],"name":"search.item.ItemEvent","type":"record"}`,
Required: []bool{
0: true,
1: true,
},
}
}
type Mode int
const (
ModeSINGULAR Mode = iota
)
var _Mode_strings = []string{
"SINGULAR",
}
// String returns the textual representation of Mode.
func (e Mode) String() string {
if e < 0 || int(e) >= len(_Mode_strings) {
return "Mode(" + strconv.FormatInt(int64(e), 10) + ")"
}
return _Mode_strings[e]
}
// MarshalText implements encoding.TextMarshaler
// by returning the textual representation of Mode.
func (e Mode) MarshalText() ([]byte, error) {
if e < 0 || int(e) >= len(_Mode_strings) {
return nil, fmt.Errorf("Mode value %d is out of bounds", e)
}
return []byte(_Mode_strings[e]), nil
}
// UnmarshalText implements encoding.TextUnmarshaler
// by expecting the textual representation of Mode.
func (e *Mode) UnmarshalText(data []byte) error {
// Note for future: this could be more efficient.
for i, s := range _Mode_strings {
if string(data) == s {
*e = Mode(i)
return nil
}
}
return fmt.Errorf("unknown value %q for Mode", data)
} |
Hi @gubtos, I had the same issue and found that using |
Hey @gubtos the same problem is happening to me! I debugged locally here and noticed that the shouldImportAvroTypeGen() function is not behaving as it should. Does it make sense to propose this fix? |
Given the following avro
And run a command like
The generated code dont imports the avrotypegen module, but uses it in the code. Given the following error:
The text was updated successfully, but these errors were encountered: