summaryrefslogtreecommitdiff
path: root/sortFunc.go
diff options
context:
space:
mode:
Diffstat (limited to 'sortFunc.go')
-rw-r--r--sortFunc.go75
1 files changed, 0 insertions, 75 deletions
diff --git a/sortFunc.go b/sortFunc.go
index 361462b..b3573a6 100644
--- a/sortFunc.go
+++ b/sortFunc.go
@@ -207,78 +207,3 @@ func (pf *File) replaceFunc(w io.Writer) {
fmt.Fprintln(w, "")
}
}
-
-func (pf *File) deleteFunc(w io.Writer) {
- var MSG string = pf.Bases.Name
- var LOCK string = pf.Bases.Lockname
-
- for _, KEY := range pf.Base.Unique {
- fmt.Fprintln(w, "func (all *"+MSG+") DeleteBy"+KEY+"(s string) bool {")
- fmt.Fprintln(w, " "+LOCK+".RLock()")
- fmt.Fprintln(w, " defer "+LOCK+".RUnlock()")
- fmt.Fprintln(w, "")
- fmt.Fprintln(w, " for i, _ := range all."+MSG+" {")
- fmt.Fprintln(w, " if all."+MSG+"[i]."+KEY+" == s {")
- fmt.Fprintln(w, " all."+MSG+"[i] = all."+MSG+"[len(all."+MSG+")-1]")
- fmt.Fprintln(w, " all."+MSG+" = all."+MSG+"[:len(all."+MSG+")-1]")
- fmt.Fprintln(w, " return true")
- fmt.Fprintln(w, " }")
- fmt.Fprintln(w, " }")
- fmt.Fprintln(w, " return false")
- fmt.Fprintln(w, "}")
- fmt.Fprintln(w, "")
- }
-}
-
-// this tries to return the deleted one but is wrong/gives warning if mutex lock is in struct
-func (pf *File) deleteWithCopyFunc(w io.Writer) {
- var MSG string = pf.Bases.Name
- var BASE string = pf.Base.Name
- var LOCK string = pf.Bases.Lockname
-
- for _, KEY := range pf.Base.Unique {
- fmt.Fprintln(w, "func (all *"+MSG+") DeleteBy"+KEY+"(s string) *"+BASE+" {")
- fmt.Fprintln(w, " "+LOCK+".RLock()")
- fmt.Fprintln(w, " defer "+LOCK+".RUnlock()")
- fmt.Fprintln(w, "")
- fmt.Fprintln(w, " var newr "+BASE)
- fmt.Fprintln(w, "")
- fmt.Fprintln(w, " for i, _ := range all."+MSG+" {")
- fmt.Fprintln(w, " if all."+MSG+"[i]."+KEY+" == s {")
- fmt.Fprintln(w, " newr = *all."+MSG+"[i]")
- fmt.Fprintln(w, " all."+MSG+"[i] = all."+MSG+"[len(all."+MSG+")-1]")
- fmt.Fprintln(w, " all."+MSG+" = all."+MSG+"[:len(all."+MSG+")-1]")
- fmt.Fprintln(w, " return &newr")
- fmt.Fprintln(w, " }")
- fmt.Fprintln(w, " }")
- fmt.Fprintln(w, " return nil")
- fmt.Fprintln(w, "}")
- fmt.Fprintln(w, "")
- }
-}
-
-func (pf *File) findFunc(w io.Writer) {
- var MSG string = pf.Bases.Name
- var BASE string = pf.Base.Name
- var LOCK string = pf.Bases.Lockname
-
- for _, KEY := range pf.Base.Unique {
- fmt.Fprintln(w, "// find a dependancy by the go path")
- fmt.Fprintln(w, "func (all *"+MSG+") FindBy"+KEY+"(s string) *"+BASE+" {")
- fmt.Fprintln(w, " if all == nil {")
- fmt.Fprintln(w, " return nil")
- fmt.Fprintln(w, " }")
- fmt.Fprintln(w, "")
- fmt.Fprintln(w, " "+LOCK+".RLock()")
- fmt.Fprintln(w, " defer "+LOCK+".RUnlock()")
- fmt.Fprintln(w, "")
- fmt.Fprintln(w, " for i, _ := range all."+MSG+" {")
- fmt.Fprintln(w, " if all."+MSG+"[i]."+KEY+" == s {")
- fmt.Fprintln(w, " return all."+MSG+"[i]")
- fmt.Fprintln(w, " }")
- fmt.Fprintln(w, " }")
- fmt.Fprintln(w, " return nil")
- fmt.Fprintln(w, "}")
- fmt.Fprintln(w, "")
- }
-}