protoc-gen-gorm icon indicating copy to clipboard operation
protoc-gen-gorm copied to clipboard

index tag should be a repeated field

Open baryluk opened this issue 2 years ago • 0 comments

gorm supports repeating index to create multiple indexes involving same column.

https://gorm.io/docs/indexes.html#Multiple-indexes

It looks like this can be somehow worked around by doing this:

message Incident {
  /*required*/ google.protobuf.Timestamp created_time = 6 [
    (gorm.field).tag = {index: "incident_idx1,priority:3;index:incident_idx2,priorty:3"}
  ];
}

This works because it will concatenate into this: "index:incident_idx1,priority:3;index:incident_idx2,priorty:3;", which is what we want.

But this is ugly hack that is not documented, and a allowing index to be repeated field should solve this problem (and likely not break any existing users).

baryluk avatar May 06 '22 15:05 baryluk