usercommon

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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 (us *UserCommon) UpdateAnswerCount(ctx context.Context, userID string, num int) error

func (*UserCommon) UpdateQuestionCount

func (us *UserCommon) UpdateQuestionCount(ctx context.Context, userID string, num int) error

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)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL