Documentation ¶
Index ¶
- type UserCommon
- func (us *UserCommon) BatchUserBasicInfoByID(ctx context.Context, IDs []string) (map[string]*schema.UserBasicInfo, error)
- func (us *UserCommon) FormatUserBasicInfo(ctx context.Context, userInfo *entity.User) *schema.UserBasicInfo
- func (us *UserCommon) GetUserBasicInfoByID(ctx context.Context, ID string) (userBasicInfo *schema.UserBasicInfo, exist bool, err error)
- func (us *UserCommon) GetUserBasicInfoByUserName(ctx context.Context, username string) (*schema.UserBasicInfo, bool, error)
- func (us *UserCommon) MakeUsername(ctx context.Context, displayName string) (username string, err error)
- func (us *UserCommon) UpdateAnswerCount(ctx context.Context, userID string, num int) error
- func (us *UserCommon) UpdateQuestionCount(ctx context.Context, userID string, num int) error
- type UserRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserCommon ¶
type UserCommon struct {
// contains filtered or unexported fields
}
UserCommon user service
func NewUserCommon ¶
func NewUserCommon(userRepo UserRepo) *UserCommon
func (*UserCommon) BatchUserBasicInfoByID ¶
func (us *UserCommon) BatchUserBasicInfoByID(ctx context.Context, IDs []string) (map[string]*schema.UserBasicInfo, error)
func (*UserCommon) FormatUserBasicInfo ¶ added in v0.5.0
func (us *UserCommon) FormatUserBasicInfo(ctx context.Context, userInfo *entity.User) *schema.UserBasicInfo
FormatUserBasicInfo format user basic info
func (*UserCommon) GetUserBasicInfoByID ¶
func (us *UserCommon) GetUserBasicInfoByID(ctx context.Context, ID string) ( userBasicInfo *schema.UserBasicInfo, exist bool, err error)
func (*UserCommon) GetUserBasicInfoByUserName ¶
func (us *UserCommon) GetUserBasicInfoByUserName(ctx context.Context, username string) (*schema.UserBasicInfo, bool, error)
func (*UserCommon) MakeUsername ¶ added in v1.0.0
func (us *UserCommon) MakeUsername(ctx context.Context, displayName string) (username string, err error)
MakeUsername Generate a unique Username based on the displayName
func (*UserCommon) UpdateAnswerCount ¶
func (*UserCommon) UpdateQuestionCount ¶
type UserRepo ¶
type UserRepo interface { AddUser(ctx context.Context, user *entity.User) (err error) IncreaseAnswerCount(ctx context.Context, userID string, amount int) (err error) IncreaseQuestionCount(ctx context.Context, userID string, amount int) (err error) UpdateLastLoginDate(ctx context.Context, userID string) (err error) UpdateEmailStatus(ctx context.Context, userID string, emailStatus int) error UpdateNoticeStatus(ctx context.Context, userID string, noticeStatus int) error UpdateEmail(ctx context.Context, userID, email string) error UpdateLanguage(ctx context.Context, userID, language string) error UpdatePass(ctx context.Context, userID, pass string) error UpdateInfo(ctx context.Context, userInfo *entity.User) (err error) GetByUserID(ctx context.Context, userID string) (userInfo *entity.User, exist bool, err error) BatchGetByID(ctx context.Context, ids []string) ([]*entity.User, error) GetByUsername(ctx context.Context, username string) (userInfo *entity.User, exist bool, err error) GetByEmail(ctx context.Context, email string) (userInfo *entity.User, exist bool, err error) GetUserCount(ctx context.Context) (count int64, err error) }
Click to show internal directories.
Click to hide internal directories.