summaryrefslogtreecommitdiff
path: root/generateSort.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-13 04:13:38 -0600
committerJeff Carr <[email protected]>2025-01-13 04:13:38 -0600
commitadcc0385f4198d80ae0b2c7ac5c791920dfcda5a (patch)
tree7cde8842b67b015bd270139cbcddcf362e6299f3 /generateSort.go
parentf74f3641879416068de07c4c10051b5e987a1e8d (diff)
corrected the mutex lock names
Diffstat (limited to 'generateSort.go')
-rw-r--r--generateSort.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/generateSort.go b/generateSort.go
index 3f14e21..100f282 100644
--- a/generateSort.go
+++ b/generateSort.go
@@ -5,8 +5,8 @@ import (
"io"
)
-func (msg *MsgName) newIterAll(w io.Writer, FRUIT, APPLE, APPLES, LOCK string) string {
- LOCK = msg.getLockname("x")
+func (msg *MsgName) newIterAll(w io.Writer, FRUIT, APPLE, APPLES, LOCKold string) string {
+ LOCK := msg.getLockname("x")
funcdef := "func (x *" + FRUIT + ") all" + APPLES + "() []*" + APPLE + " {"
@@ -79,7 +79,7 @@ func newIter(w io.Writer, msg *MsgName) string {
// maybe there are better ways in GO now adays // that's fine though. this is easy to read
// TODO; figure out what types this actually works on
// TODO; add timestamppb compare
-func newSortType(w io.Writer, STRUCT, VARNAME string) string {
+func (msg *MsgName) newSortType(w io.Writer, STRUCT, VARNAME string) string {
// Can these be lower case? Should they be lower case? maybe sort.Sort() requires upper case?
fmt.Fprintln(w, "// sort struct by", VARNAME)
@@ -93,7 +93,7 @@ func newSortType(w io.Writer, STRUCT, VARNAME string) string {
return "type " + STRUCT + VARNAME + " []*" + STRUCT + " // { return a[i]." + VARNAME + " < a[j]." + VARNAME + " }"
}
-func newSortBy(w io.Writer, STRUCT, ITER, SORTNAME, SORTBY, SELECT, VARNAME string) string {
+func (msg *MsgName) newSortBy(w io.Writer, STRUCT, ITER, SORTNAME, SORTBY, SELECT, VARNAME string) string {
funcdef := "func (x *" + STRUCT + ") " + SORTBY + "() *" + ITER + "Iterator"
fmt.Fprintln(w, funcdef, "{")
@@ -113,7 +113,7 @@ func newSortBy(w io.Writer, STRUCT, ITER, SORTNAME, SORTBY, SELECT, VARNAME stri
return funcdef
}
-func addAllFunc(w io.Writer, FRUIT, APPLE, APPLES string) string {
+func (msg *MsgName) addAllFunc(w io.Writer, FRUIT, APPLE, APPLES string) string {
funcdef := "func (x *" + FRUIT + ") All() *" + APPLE + "Iterator {"
fmt.Fprintln(w, funcdef)
@@ -129,7 +129,9 @@ func addAllFunc(w io.Writer, FRUIT, APPLE, APPLES string) string {
return funcdef
}
-func addLenFunc(w io.Writer, FRUIT, APPLES, LOCK string) string {
+func (msg *MsgName) addLenFunc(w io.Writer, FRUIT, APPLES, LOCKold string) string {
+ LOCK := msg.getLockname("x")
+
funcdef := "func (x *" + FRUIT + ") Len() int {"
fmt.Fprintln(w, "")
fmt.Fprintln(w, funcdef)
@@ -143,8 +145,8 @@ func addLenFunc(w io.Writer, FRUIT, APPLES, LOCK string) string {
return funcdef
}
-func (msg *MsgName) addSelectAll(w io.Writer, FRUIT, APPLE, APPLES, LOCK string) string {
- LOCK = msg.getLockname("x")
+func (msg *MsgName) addSelectAll(w io.Writer, FRUIT, APPLE, APPLES, LOCKold string) string {
+ LOCK := msg.getLockname("x")
funcdef := "func (x *" + FRUIT + ") selectAll" + APPLES + "() []*" + APPLE
fmt.Fprintln(w, "// safely returns a slice of pointers to the "+APPLE+" protobufs")