summaryrefslogtreecommitdiff
path: root/generate.go
diff options
context:
space:
mode:
Diffstat (limited to 'generate.go')
-rw-r--r--generate.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/generate.go b/generate.go
index fbb1943..4632997 100644
--- a/generate.go
+++ b/generate.go
@@ -39,6 +39,9 @@ func (pb *Files) makeNewSortfile(pf *File) error {
// can't work against slices
continue
}
+ if v.VarType != "string" {
+ continue
+ }
VARNAME := v.VarName
funcdef := newSortType(wSort, PARENT, VARNAME)
log.Printf("Adding %s\n", funcdef)
@@ -186,6 +189,12 @@ func (pb *Files) makeNewSortfile(pf *File) error {
PARENT := s.MsgName
VARNAME := s.VarName
+ if PARENT != VARNAME {
+ // this does not conform to the autogenpb standard format
+ continue
+ }
+ // special case because of the enforced .proto format // ONLY SUPPORT THIS
+
msg := pf.findMsg(s.VarType)
if msg == nil {
return fmt.Errorf("failed to find struct %s", s.VarType)
@@ -193,6 +202,9 @@ func (pb *Files) makeNewSortfile(pf *File) error {
// find()
for _, v := range msg.Vars {
+ if v.VarType != "string" {
+ continue
+ }
if v.IsRepeated {
continue
}
@@ -203,7 +215,7 @@ func (pb *Files) makeNewSortfile(pf *File) error {
if PARENT == VARNAME {
// special case because of the enforced .proto format
FUNCNAME = "FindBy" + v.VarName
- funcdef := msg.generateFindBy(wSort, FUNCNAME, PARENT, VARNAME, s.VarType, v.VarName)
+ funcdef := msg.generateFindBy(wSort, FUNCNAME, PARENT, s, v)
// func (msg *MsgName) generateFindBy(w io.Writer, FUNCNAME, STRUCT, VARNAME, VARTYPE, COLOR string) string {
log.Printf("Adding %s\n", funcdef)
} else {
@@ -222,6 +234,9 @@ func (pb *Files) makeNewSortfile(pf *File) error {
// delete() functions
for _, v := range msg.Vars {
+ if v.VarType != "string" {
+ continue
+ }
if v.IsRepeated {
continue
}
@@ -254,6 +269,9 @@ func (pb *Files) makeNewSortfile(pf *File) error {
// AppendBy() functions. todo: fix these so Append() is for simple things and Insert() is for unique keys
var ucount int
for _, v := range msg.Vars {
+ if v.VarType != "string" {
+ continue
+ }
if v.IsRepeated {
continue
}