diff options
Diffstat (limited to 'activitypub/activityPubStruct.go')
-rw-r--r-- | activitypub/activityPubStruct.go | 12 |
1 files changed, 12 insertions, 0 deletions
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] } |