You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tencent-im/profile/profile.go

40 lines
689 B
Go

/**
* @Author: Echo
* @Email:1711788888@qq.com
* @Date: 2021/8/28 11:23 上午
* @Desc: TODO
*/
package profile
import (
"git.echol.cn/loser/tencent-im/internal/core"
"git.echol.cn/loser/tencent-im/internal/entity"
"git.echol.cn/loser/tencent-im/internal/enum"
)
type Profile struct {
entity.User
}
func NewProfile(userId ...string) *Profile {
p := &Profile{}
if len(userId) > 0 {
p.SetUserId(userId[0])
}
return p
}
// CheckError 检测错误
func (p *Profile) CheckError() (err error) {
if userId := p.GetUserId(); userId == "" {
return core.NewError(enum.InvalidParamsCode, "the userid is not set")
}
if err = p.GetError(); err != nil {
return
}
return
}