summaryrefslogtreecommitdiff
path: root/stat.SortCtime.go
blob: ccf4b484b419d85d40c4e2123d76963973e82fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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] }