use ptr for ordering

This commit is contained in:
Özgür Kesim 2024-01-07 20:00:15 +01:00
parent dc372d272f
commit cde0b39265

View File

@ -27,7 +27,7 @@ import (
"time" "time"
) )
type Issues []Issue type Issues []*Issue
type Issue struct { type Issue struct {
Id uint32 Id uint32
@ -96,7 +96,7 @@ type Change struct {
Note struct{ id int32 } Note struct{ id int32 }
} }
type ByCategory []Issue type ByCategory []*Issue
func (b ByCategory) Len() int { return len(b) } func (b ByCategory) Len() int { return len(b) }
func (b ByCategory) Less(i, j int) bool { func (b ByCategory) Less(i, j int) bool {
@ -104,7 +104,7 @@ func (b ByCategory) Less(i, j int) bool {
} }
func (b ByCategory) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b ByCategory) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
type ByAssignment []Issue type ByAssignment []*Issue
func (b ByAssignment) Len() int { return len(b) } func (b ByAssignment) Len() int { return len(b) }
func (b ByAssignment) Less(i, j int) bool { func (b ByAssignment) Less(i, j int) bool {
@ -112,13 +112,13 @@ func (b ByAssignment) Less(i, j int) bool {
} }
func (b ByAssignment) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b ByAssignment) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
type ById []Issue type ById []*Issue
func (b ById) Len() int { return len(b) } func (b ById) Len() int { return len(b) }
func (b ById) Less(i, j int) bool { return b[i].Id < b[j].Id } func (b ById) Less(i, j int) bool { return b[i].Id < b[j].Id }
func (b ById) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b ById) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
type ByTarget []Issue type ByTarget []*Issue
func (b ByTarget) Len() int { return len(b) } func (b ByTarget) Len() int { return len(b) }
func (b ByTarget) Less(i, j int) bool { func (b ByTarget) Less(i, j int) bool {
@ -126,7 +126,7 @@ func (b ByTarget) Less(i, j int) bool {
} }
func (b ByTarget) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b ByTarget) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
type ByHandlerAndId []Issue type ByHandlerAndId []*Issue
func (b ByHandlerAndId) Len() int { return len(b) } func (b ByHandlerAndId) Len() int { return len(b) }
func (b ByHandlerAndId) Less(i, j int) bool { func (b ByHandlerAndId) Less(i, j int) bool {
@ -238,7 +238,7 @@ func (ms *multiSorter) Swap(i, j int) {
} }
func (ms *multiSorter) Less(i, j int) bool { func (ms *multiSorter) Less(i, j int) bool {
p, q := &ms.issues[i], &ms.issues[j] p, q := ms.issues[i], ms.issues[j]
var k int var k int
for k = 0; k < len(ms.less)-1; k++ { for k = 0; k < len(ms.less)-1; k++ {
less := ms.less[k] less := ms.less[k]