You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
587 B
32 lines
587 B
package msg
|
|
|
|
import (
|
|
"github.com/openimsdk/protocol/msg"
|
|
"github.com/openimsdk/tools/errs"
|
|
"github.com/redis/go-redis/v9"
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
)
|
|
|
|
func IsNotFound(err error) bool {
|
|
switch errs.Unwrap(err) {
|
|
case redis.Nil, mongo.ErrNoDocuments:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
type activeConversations []*msg.ActiveConversation
|
|
|
|
func (s activeConversations) Len() int {
|
|
return len(s)
|
|
}
|
|
|
|
func (s activeConversations) Less(i, j int) bool {
|
|
return s[i].LastTime > s[j].LastTime
|
|
}
|
|
|
|
func (s activeConversations) Swap(i, j int) {
|
|
s[i], s[j] = s[j], s[i]
|
|
}
|