protoc-gen-gorm
protoc-gen-gorm copied to clipboard
Regression in GormTag index and unique_index handling
This code from version v0.21.0
will never allow for index;
tag to be generated:
if len(tag.Index) > 0 {
if tag.GetIndex() == "" {
gormRes += "index;"
} else {
gormRes += fmt.Sprintf("index:%s;", tag.GetIndex())
}
}
Same holds for the unique_index;
.
The code should allow encoding three states:
- index without name
- index with name
- no index
Currently it only allows index with name and no index variants. This is regression from previous version (v0.20.1).
Looking into GormTag proto message definition, it looks like it is not using optional anymore.