generates generic Append()
This commit is contained in:
parent
c4355fb69e
commit
5b4491f17b
1
Makefile
1
Makefile
|
@ -16,6 +16,7 @@ test:
|
|||
make goimports vet build
|
||||
make -C example testGlobal
|
||||
make -C example testProtoc
|
||||
make -C example all
|
||||
|
||||
dryrun: build
|
||||
make -C example dryrun
|
||||
|
|
16
generate.go
16
generate.go
|
@ -153,6 +153,12 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
|||
funcdef += " # is special struct=varname"
|
||||
log.Printf("LEN: %-2d %20s %20s %20s %20s %s\n", i, PARENT, CHILD, VARNAME, LOCK, funcdef)
|
||||
}
|
||||
if PARENT == VARNAME {
|
||||
// FUNCNAME := "Append"
|
||||
msg.simpleAppend(wSort, PARENT, v.VarName, v.VarType)
|
||||
// funcdef := msg.addAppendBy(wSort, PARENT, FUNCNAME, VARNAME, PARENT, s.VarType)
|
||||
// log.Printf(" %-2s %20s %20s %20s %s %s\n", "", "", "", "done", "", funcdef)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +248,7 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
|||
var FUNCNAME string
|
||||
if PARENT == VARNAME {
|
||||
// special case because of the enforced .proto format
|
||||
FUNCNAME = "Find" + v.VarName
|
||||
FUNCNAME = "FindBy" + v.VarName
|
||||
} else {
|
||||
FUNCNAME = "Find" + VARNAME + "By" + v.VarName
|
||||
}
|
||||
|
@ -276,7 +282,7 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
|||
var FUNCNAME string
|
||||
if PARENT == VARNAME {
|
||||
// special case because of the enforced .proto format
|
||||
FUNCNAME = "Delete" + v.VarName
|
||||
FUNCNAME = "DeleteBy" + v.VarName
|
||||
} else {
|
||||
FUNCNAME = "Delete" + VARNAME + "By" + v.VarName
|
||||
}
|
||||
|
@ -289,8 +295,8 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
|||
log.Printf(" %-2s %20s %20s %20s %s %s\n", "", "", "", "done", "", funcdef)
|
||||
}
|
||||
|
||||
// AppendBy() functions. these maybe need to be rethought
|
||||
var ucount int
|
||||
// append() functions. these need to be rethought
|
||||
for _, v := range msg.Vars {
|
||||
if v.IsRepeated {
|
||||
continue
|
||||
|
@ -302,13 +308,13 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
|||
var FUNCNAME string
|
||||
if PARENT == VARNAME {
|
||||
// special case because of the enforced .proto format
|
||||
FUNCNAME = "Append" + v.VarName
|
||||
FUNCNAME = "AppendBy" + v.VarName
|
||||
} else {
|
||||
FUNCNAME = "Append" + VARNAME + "By" + v.VarName
|
||||
}
|
||||
funcdef := msg.addAppendBy(wSort, PARENT, FUNCNAME, VARNAME, v.VarName, s.VarType)
|
||||
log.Printf(" %-2s %20s %20s %20s %s %s\n", "", "", "", "done", "", funcdef)
|
||||
}
|
||||
}
|
||||
|
||||
if ucount == 1 {
|
||||
for _, v := range msg.Vars {
|
||||
|
|
Loading…
Reference in New Issue