diff options
| author | Jeff Carr <[email protected]> | 2025-10-16 15:18:04 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-16 15:18:04 -0500 |
| commit | 9a0089928e713a35b4a5c0ab46b86fd1a2e498da (patch) | |
| tree | d8d91e8d9797f3222bcfd8d244c137e34eaadbd5 /stat.SortCtime.go | |
| parent | 43599276915dbcef6f941aa31cfea9cc2c2512aa (diff) | |
try to sort by time. didn't work
Diffstat (limited to 'stat.SortCtime.go')
| -rw-r--r-- | stat.SortCtime.go | 32 |
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] } |
