beancount-gs/script/sort.go

30 lines
475 B
Go
Raw Permalink Normal View History

2021-11-23 06:58:37 +00:00
package script
type AccountTypeSort []AccountType
func (s AccountTypeSort) Len() int {
return len(s)
}
func (s AccountTypeSort) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s AccountTypeSort) Less(i, j int) bool {
return s[i].Key <= s[j].Key
}
2021-11-26 09:12:07 +00:00
type AccountSort []Account
2021-11-23 06:58:37 +00:00
func (s AccountSort) Len() int {
return len(s)
}
func (s AccountSort) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s AccountSort) Less(i, j int) bool {
return s[i].Acc <= s[j].Acc
}