summaryrefslogtreecommitdiff
path: root/stat.SortCtime.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-16 15:18:04 -0500
committerJeff Carr <[email protected]>2025-10-16 15:18:04 -0500
commit9a0089928e713a35b4a5c0ab46b86fd1a2e498da (patch)
treed8d91e8d9797f3222bcfd8d244c137e34eaadbd5 /stat.SortCtime.go
parent43599276915dbcef6f941aa31cfea9cc2c2512aa (diff)
try to sort by time. didn't work
Diffstat (limited to 'stat.SortCtime.go')
-rw-r--r--stat.SortCtime.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/stat.SortCtime.go b/stat.SortCtime.go
new file mode 100644
index 0000000..ccf4b48
--- /dev/null
+++ b/stat.SortCtime.go
@@ -0,0 +1,32 @@
+// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
+// go install go.wit.com/apps/autogenpb@latest
+//
+// This file was autogenerated with autogenpb:
+// autogenpb v0.5.27 Built on 2025/10/16 17:13:05 ( 52 m)
+// Theese sort.pb.go and marshal.pb.go files are autogenerated
+// The autogenpb sources have example .proto files with instructions
+//
+
+package gitpb
+
+import (
+ "sort"
+)
+
+func (pb *Stats) SortCtime() {
+ statMu.Lock()
+ defer statMu.Unlock()
+
+ sort.Sort(sortStatCtime(pb.Stats))
+}
+
+// sort struct by Ctime
+type sortStatCtime []*Stat
+
+func (a sortStatCtime) Len() int { return len(a) }
+func (a sortStatCtime) Less(i, j int) bool {
+ itime := a[i].Ctime.AsTime()
+ jtime := a[j].Ctime.AsTime()
+ return itime.Before(jtime)
+}
+func (a sortStatCtime) Swap(i, j int) { a[i], a[j] = a[j], a[i] }