mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
user update
This commit is contained in:
parent
642743957e
commit
e99753f188
@ -79,7 +79,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = s.Update(ctx, []*tablerelation.UserModel{user})
|
||||
err = s.Update(ctx, user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ type UserDatabase interface {
|
||||
//插入多条 外部保证userID 不重复 且在db中不存在
|
||||
Create(ctx context.Context, users []*relation.UserModel) (err error)
|
||||
//更新(非零值) 外部保证userID存在
|
||||
Update(ctx context.Context, users []*relation.UserModel) (err error)
|
||||
Update(ctx context.Context, user *relation.UserModel) (err error)
|
||||
//更新(零值) 外部保证userID存在
|
||||
UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error)
|
||||
//如果没找到,不返回错误
|
||||
@ -75,8 +75,8 @@ func (u *userDatabase) Create(ctx context.Context, users []*relation.UserModel)
|
||||
}
|
||||
|
||||
// 更新(非零值) 外部保证userID存在
|
||||
func (u *userDatabase) Update(ctx context.Context, users []*relation.UserModel) (err error) {
|
||||
return u.userDB.Update(ctx, users)
|
||||
func (u *userDatabase) Update(ctx context.Context, user *relation.UserModel) (err error) {
|
||||
return u.userDB.Update(ctx, user)
|
||||
}
|
||||
|
||||
// 更新(零值) 外部保证userID存在
|
||||
|
@ -26,8 +26,8 @@ func (u *UserGorm) UpdateByMap(ctx context.Context, userID string, args map[stri
|
||||
}
|
||||
|
||||
// 更新多个用户信息 非零值
|
||||
func (u *UserGorm) Update(ctx context.Context, users []*relation.UserModel) (err error) {
|
||||
return utils.Wrap(u.db(ctx).Updates(&users).Error, "")
|
||||
func (u *UserGorm) Update(ctx context.Context, user *relation.UserModel) (err error) {
|
||||
return utils.Wrap(u.db(ctx).Updates(&user).Error, "")
|
||||
}
|
||||
|
||||
// 获取指定用户信息 不存在,也不返回错误
|
||||
|
@ -31,7 +31,7 @@ func (UserModel) TableName() string {
|
||||
type UserModelInterface interface {
|
||||
Create(ctx context.Context, users []*UserModel) (err error)
|
||||
UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error)
|
||||
Update(ctx context.Context, users []*UserModel) (err error)
|
||||
Update(ctx context.Context, user *UserModel) (err error)
|
||||
// 获取指定用户信息 不存在,也不返回错误
|
||||
Find(ctx context.Context, userIDs []string) (users []*UserModel, err error)
|
||||
// 获取某个用户信息 不存在,则返回错误
|
||||
|
Loading…
x
Reference in New Issue
Block a user