summaryrefslogtreecommitdiff
path: root/parseProtoFile.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-09 03:42:29 -0600
committerJeff Carr <[email protected]>2025-01-09 03:42:29 -0600
commit4ff3a92bc684dfc2d136b1d2ae620097573056b9 (patch)
tree9feba91647f71305a683f4adee0937022363f3d6 /parseProtoFile.go
parent355817c0db0152c22162969e88e064197cb054f7 (diff)
builds
Diffstat (limited to 'parseProtoFile.go')
-rw-r--r--parseProtoFile.go33
1 files changed, 24 insertions, 9 deletions
diff --git a/parseProtoFile.go b/parseProtoFile.go
index b62e5e2..49f382c 100644
--- a/parseProtoFile.go
+++ b/parseProtoFile.go
@@ -38,18 +38,33 @@ func (pb *Files) findAutogenpb(f *File) error {
// log.Info("line:", line)
parts := strings.Fields(line)
- if strings.Contains(line, "autogenpb:marshal") {
- newm := parts[1]
- if curmsg != nil {
- // log.Info("found marshal", newm)
- marshalKeys = append(marshalKeys, newm)
+
+ if strings.Contains(line, "autogenpb:sort") {
+ if parts[0] == "repeated" {
+ newm := parts[1]
+ if curmsg == nil {
+ log.Info("Error: Found Sort for:", newm, "however, this struct can't be used")
+ // log.Info("found marshal", newm)
+ marshalKeys = append(marshalKeys, newm)
+ } else {
+ log.Info("Found Sort for:", newm, "in struct", curmsg.Name)
+ }
+ } else {
+ log.Info("Error:", line)
+ log.Info("Error: can not sort on non repeated fields")
}
}
if strings.Contains(line, "autogenpb:unique") {
- newu := parts[1]
- newu = cases.Title(language.English, cases.NoLower).String(newu)
- // log.Info("found unique field", newu)
- uniqueKeys = append(uniqueKeys, newu)
+ if parts[0] == "repeated" {
+ // log.Info("Found Unique for:", parts)
+ newu := parts[1]
+ newu = cases.Title(language.English, cases.NoLower).String(newu)
+ log.Info("found unique field", newu, "in struct", curmsg.Name)
+ // uniqueKeys = append(uniqueKeys, newu)
+ } else {
+ log.Info("Error:", line)
+ log.Info("Error: can not append on non repeated fields")
+ }
}
}
return nil