diff options
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] } |
