Open gubtos opened 9 months ago
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 -tokenize
solves it.
Try calling avrogo -p is -tokenize item-search.avsc
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. I think the problem is in the use of the sort.Search() function. I believe this function does not fit the desired purpose...
Does it make sense to propose this fix? What do you think?
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: