mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 22:35:52 +01:00
responses: add Equal method for LazyLoadSummary
This commit is contained in:
parent
02a0aad583
commit
364ae39fef
1 changed files with 13 additions and 0 deletions
13
responses.go
13
responses.go
|
|
@ -6,12 +6,14 @@ import (
|
|||
"fmt"
|
||||
"maps"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/tidwall/sjson"
|
||||
"go.mau.fi/util/jsontime"
|
||||
"go.mau.fi/util/ptr"
|
||||
|
||||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/id"
|
||||
|
|
@ -342,6 +344,17 @@ type LazyLoadSummary struct {
|
|||
InvitedMemberCount *int `json:"m.invited_member_count,omitempty"`
|
||||
}
|
||||
|
||||
func (lls *LazyLoadSummary) Equal(other *LazyLoadSummary) bool {
|
||||
if lls == other {
|
||||
return true
|
||||
} else if lls == nil || other == nil {
|
||||
return false
|
||||
}
|
||||
return ptr.Val(lls.JoinedMemberCount) == ptr.Val(other.JoinedMemberCount) &&
|
||||
ptr.Val(lls.InvitedMemberCount) == ptr.Val(other.InvitedMemberCount) &&
|
||||
slices.Equal(lls.Heroes, other.Heroes)
|
||||
}
|
||||
|
||||
type SyncEventsList struct {
|
||||
Events []*event.Event `json:"events,omitempty"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue