mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-06-03 22:39:28 +08:00
Error code standardization
This commit is contained in:
parent
29c1bb86d8
commit
8e8ee2b968
@ -58,9 +58,9 @@ func (*Friend) Find(ctx context.Context, ownerUserID string) (friends []*Friend,
|
||||
return friends, err
|
||||
}
|
||||
|
||||
func (*Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (group *Group, err error) {
|
||||
group = &Group{}
|
||||
defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *group)
|
||||
err = utils.Wrap(FriendDB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(group).Error, "")
|
||||
return group, err
|
||||
func (*Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *Friend, err error) {
|
||||
friend = &Friend{}
|
||||
defer trace_log.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "group", *friend)
|
||||
err = utils.Wrap(FriendDB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "")
|
||||
return friend, err
|
||||
}
|
||||
|
@ -56,10 +56,11 @@ func (*User) Find(ctx context.Context, userIDs []string) (users []*User, err err
|
||||
return users, err
|
||||
}
|
||||
|
||||
func (*User) Take(ctx context.Context, userIDs []string) (users []*User, err error) {
|
||||
func (*User) Take(ctx context.Context, userID string) (user *User, err error) {
|
||||
user = &User{}
|
||||
defer func() {
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userIDs", userIDs, "users", users)
|
||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "user", *user)
|
||||
}()
|
||||
err = utils.Wrap(userDB.Where("user_id in (?)", userIDs).Take(&users).Error, "")
|
||||
return users, err
|
||||
err = utils.Wrap(userDB.Where("user_id = ?", userID).Take(&user).Error, "")
|
||||
return user, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user