From 36a41e03c59624a2b4a7eb174e9a003e288a1d7d Mon Sep 17 00:00:00 2001 From: KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:55:59 -0300 Subject: restructuring, part 4 of many --- activitypub/activityPubStruct.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activitypub') diff --git a/activitypub/activityPubStruct.go b/activitypub/activityPubStruct.go index 002d514..637982d 100644 --- a/activitypub/activityPubStruct.go +++ b/activitypub/activityPubStruct.go @@ -204,3 +204,15 @@ type Collection struct { AtContext CollectionBase } + +type ObjectBaseSortDesc []ObjectBase + +func (a ObjectBaseSortDesc) Len() int { return len(a) } +func (a ObjectBaseSortDesc) Less(i, j int) bool { return a[i].Updated.After(a[j].Updated) } +func (a ObjectBaseSortDesc) Swap(i, j int) { a[i], a[j] = a[j], a[i] } + +type ObjectBaseSortAsc []ObjectBase + +func (a ObjectBaseSortAsc) Len() int { return len(a) } +func (a ObjectBaseSortAsc) Less(i, j int) bool { return a[i].Published.Before(a[j].Published) } +func (a ObjectBaseSortAsc) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -- cgit v1.2.3