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 goimports vet build
|
||||||
make -C example testGlobal
|
make -C example testGlobal
|
||||||
make -C example testProtoc
|
make -C example testProtoc
|
||||||
|
make -C example all
|
||||||
|
|
||||||
dryrun: build
|
dryrun: build
|
||||||
make -C example dryrun
|
make -C example dryrun
|
||||||
|
|
18
generate.go
18
generate.go
|
@ -153,6 +153,12 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
||||||
funcdef += " # is special struct=varname"
|
funcdef += " # is special struct=varname"
|
||||||
log.Printf("LEN: %-2d %20s %20s %20s %20s %s\n", i, PARENT, CHILD, VARNAME, LOCK, funcdef)
|
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
|
var FUNCNAME string
|
||||||
if PARENT == VARNAME {
|
if PARENT == VARNAME {
|
||||||
// special case because of the enforced .proto format
|
// special case because of the enforced .proto format
|
||||||
FUNCNAME = "Find" + v.VarName
|
FUNCNAME = "FindBy" + v.VarName
|
||||||
} else {
|
} else {
|
||||||
FUNCNAME = "Find" + VARNAME + "By" + v.VarName
|
FUNCNAME = "Find" + VARNAME + "By" + v.VarName
|
||||||
}
|
}
|
||||||
|
@ -276,7 +282,7 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
||||||
var FUNCNAME string
|
var FUNCNAME string
|
||||||
if PARENT == VARNAME {
|
if PARENT == VARNAME {
|
||||||
// special case because of the enforced .proto format
|
// special case because of the enforced .proto format
|
||||||
FUNCNAME = "Delete" + v.VarName
|
FUNCNAME = "DeleteBy" + v.VarName
|
||||||
} else {
|
} else {
|
||||||
FUNCNAME = "Delete" + VARNAME + "By" + v.VarName
|
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)
|
log.Printf(" %-2s %20s %20s %20s %s %s\n", "", "", "", "done", "", funcdef)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AppendBy() functions. these maybe need to be rethought
|
||||||
var ucount int
|
var ucount int
|
||||||
// append() functions. these need to be rethought
|
|
||||||
for _, v := range msg.Vars {
|
for _, v := range msg.Vars {
|
||||||
if v.IsRepeated {
|
if v.IsRepeated {
|
||||||
continue
|
continue
|
||||||
|
@ -302,12 +308,12 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
||||||
var FUNCNAME string
|
var FUNCNAME string
|
||||||
if PARENT == VARNAME {
|
if PARENT == VARNAME {
|
||||||
// special case because of the enforced .proto format
|
// special case because of the enforced .proto format
|
||||||
FUNCNAME = "Append" + v.VarName
|
FUNCNAME = "AppendBy" + v.VarName
|
||||||
} else {
|
} else {
|
||||||
FUNCNAME = "Append" + VARNAME + "By" + v.VarName
|
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)
|
||||||
}
|
}
|
||||||
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 {
|
if ucount == 1 {
|
||||||
|
|
Loading…
Reference in New Issue