mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-02 16:15:59 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
Conflicts: cmd/rpc/auth/main.go cmd/rpc/friend/main.go cmd/rpc/group/main.go cmd/rpc/msg/main.go cmd/rpc/user/main.go internal/rpc/auth/auth.go internal/rpc/conversation/conversaion.go internal/rpc/friend/friend.go internal/rpc/group/callback.go internal/rpc/group/group.go internal/rpc/msg/pull_message.go internal/rpc/msg/query_msg.go internal/rpc/msg/rpc_chat.go internal/rpc/msg/send_msg.go internal/rpc/user/user.go pkg/common/db/cache/redis.go pkg/common/db/controller/msg.go pkg/common/http/http_client.go
This commit is contained in:
@@ -412,3 +412,24 @@ func (o *sortSlice[E]) Swap(i, j int) {
|
||||
type Ordered interface {
|
||||
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string
|
||||
}
|
||||
|
||||
func Unwrap(err error) error {
|
||||
for err != nil {
|
||||
unwrap, ok := err.(interface {
|
||||
Unwrap() error
|
||||
})
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
err = unwrap.Unwrap()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// NotNilReplace 当new_不为空时, 将old设置为new_
|
||||
func NotNilReplace[T any](old, new_ *T) {
|
||||
if old == nil || new_ == nil {
|
||||
return
|
||||
}
|
||||
*old = *new_
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user