user

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPasswordTooShort       = errors.New("password too short")
	ErrPasswordTooLong        = errors.New("password too long")
	ErrPasswordHasInvalidChar = errors.New("password has invalid char")

	ErrUsernameTooShort       = errors.New("username too short")
	ErrUsernameTooLong        = errors.New("username too long")
	ErrUsernameHasInvalidChar = errors.New("username has invalid char")
)
View Source
var ProviderSet = wire.NewSet(NewUserService)

ProviderSet is service providers.

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword []byte) bool

func CheckUserPassword

func CheckUserPassword(u *model.User, password string) bool

func GenUserPassword

func GenUserPassword(password string) ([]byte, error)

func GenUserPasswordVersion

func GenUserPasswordVersion(hashedPassword []byte) uint32

func NewDBUtils

func NewDBUtils(db *gorm.DB) *dbUtils

func SetUserPassword

func SetUserPassword(u *model.User, password string) error

func SetUsername added in v0.2.2

func SetUsername(u *model.User, name string) error

Types

type UserRcache

type UserRcache struct {
	// contains filtered or unexported fields
}

func NewUserRcache

func NewUserRcache(rcache *rcache.Rcache, client *dbUtils) *UserRcache

func (*UserRcache) DelUserIDCache

func (uc *UserRcache) DelUserIDCache(ctx context.Context, name string) error

func (*UserRcache) DelUserInfoCache

func (uc *UserRcache) DelUserInfoCache(ctx context.Context, id string) error

func (*UserRcache) DelUserPasswordVersionCache

func (uc *UserRcache) DelUserPasswordVersionCache(ctx context.Context, id string) error

func (*UserRcache) GetUserID

func (uc *UserRcache) GetUserID(ctx context.Context, name string) (string, error)

func (*UserRcache) GetUserIDFromCache

func (uc *UserRcache) GetUserIDFromCache(ctx context.Context, name string) (string, error)

func (*UserRcache) GetUserInfo

func (uc *UserRcache) GetUserInfo(ctx context.Context, id string, fields ...string) (*user.UserInfo, error)

func (*UserRcache) GetUserInfoByUsername added in v0.2.2

func (uc *UserRcache) GetUserInfoByUsername(ctx context.Context, name string, fields ...string) (*user.UserInfo, error)

func (*UserRcache) GetUserInfoFromCache

func (uc *UserRcache) GetUserInfoFromCache(ctx context.Context, id string, fields ...string) (*user.UserInfo, error)

func (*UserRcache) GetUserLastSeen added in v0.3.0

func (uc *UserRcache) GetUserLastSeen(ctx context.Context, id string) (*user.UserLastSeen, error)

func (*UserRcache) GetUserPasswordVersion

func (uc *UserRcache) GetUserPasswordVersion(ctx context.Context, id string) (uint32, error)

func (*UserRcache) GetUserPasswordVersionFromCache

func (uc *UserRcache) GetUserPasswordVersionFromCache(ctx context.Context, id string) (uint64, error)

func (*UserRcache) SetUserIDToCache

func (uc *UserRcache) SetUserIDToCache(ctx context.Context, name, id string) error

func (*UserRcache) SetUserInfoToCache

func (uc *UserRcache) SetUserInfoToCache(ctx context.Context, id string, info *user.UserInfo) error

func (*UserRcache) SetUserPassword

func (uc *UserRcache) SetUserPassword(ctx context.Context, id string, password string) error

func (*UserRcache) SetUserPasswordVersionToCache

func (uc *UserRcache) SetUserPasswordVersionToCache(ctx context.Context, id string, version uint32) error

func (*UserRcache) SetUserRole

func (uc *UserRcache) SetUserRole(ctx context.Context, id string, role user.Role) error

func (*UserRcache) SetUserStatus

func (uc *UserRcache) SetUserStatus(ctx context.Context, id string, status user.Status) error

func (*UserRcache) SetUsername added in v0.2.2

func (uc *UserRcache) SetUsername(ctx context.Context, id, name string) (string, error)

func (*UserRcache) UpdateUserLastSeen added in v0.3.0

func (uc *UserRcache) UpdateUserLastSeen(ctx context.Context, id string, lastSeen *user.UserLastSeen) error

type UserService

type UserService struct {
	user.UnimplementedUserServer
	// contains filtered or unexported fields
}

func (*UserService) BindEmail added in v0.3.0

func (us *UserService) BindEmail(ctx context.Context, req *user.BindEmailReq) (*user.Empty, error)

func (*UserService) CreateUser

func (us *UserService) CreateUser(ctx context.Context, req *user.CreateUserReq) (*user.UserInfo, error)

func (*UserService) FollowAllDevice added in v0.3.0

func (us *UserService) FollowAllDevice(ctx context.Context, req *user.FollowAllDeviceReq) (*user.Empty, error)

func (*UserService) FollowDevice added in v0.3.0

func (us *UserService) FollowDevice(ctx context.Context, req *user.FollowDeviceReq) (*user.Empty, error)

func (*UserService) GetUserId

func (us *UserService) GetUserId(ctx context.Context, req *user.GetUserIdReq) (*user.GetUserIdResp, error)

func (*UserService) GetUserInfo

func (us *UserService) GetUserInfo(ctx context.Context, req *user.GetUserInfoReq) (*user.UserInfo, error)

func (*UserService) GetUserInfoByUsername added in v0.2.2

func (us *UserService) GetUserInfoByUsername(ctx context.Context, req *user.GetUserInfoByUsernameReq) (*user.UserInfo, error)

func (*UserService) GetUserLastSeen added in v0.3.0

func (us *UserService) GetUserLastSeen(ctx context.Context, req *user.GetUserLastSeenReq) (*user.UserLastSeen, error)

func (*UserService) GetUserPasswordVersion

func (*UserService) HasFollowedDevice added in v0.3.0

func (us *UserService) HasFollowedDevice(ctx context.Context, req *user.HasFollowedDeviceReq) (*user.HasFollowedDeviceResp, error)

func (*UserService) ListFollowedDeviceIDs added in v0.3.0

func (*UserService) ListFollowedUserIDsByDevice added in v0.3.0

func (*UserService) ListUser

func (us *UserService) ListUser(ctx context.Context, req *user.ListUserReq) (*user.ListUserResp, error)

func (*UserService) SetUserPassword

func (us *UserService) SetUserPassword(ctx context.Context, req *user.SetUserPasswordReq) (*user.Empty, error)

func (*UserService) SetUserRole

func (us *UserService) SetUserRole(ctx context.Context, req *user.SetUserRoleReq) (*user.Empty, error)

func (*UserService) SetUserStatus

func (us *UserService) SetUserStatus(ctx context.Context, req *user.SetUserStatusReq) (*user.Empty, error)

func (*UserService) SetUsername added in v0.2.2

func (us *UserService) SetUsername(ctx context.Context, req *user.SetUsernameReq) (*user.SetUsernameResp, error)

func (*UserService) UnbindEmail added in v0.3.0

func (us *UserService) UnbindEmail(ctx context.Context, req *user.UnbindEmailReq) (*user.Empty, error)

func (*UserService) UnfollowAllDevice added in v0.3.0

func (us *UserService) UnfollowAllDevice(ctx context.Context, req *user.UnfollowAllDeviceReq) (*user.Empty, error)

func (*UserService) UnfollowDevice added in v0.3.0

func (us *UserService) UnfollowDevice(ctx context.Context, req *user.UnfollowDeviceReq) (*user.Empty, error)

func (*UserService) UpdateUserLastSeen added in v0.3.0

func (us *UserService) UpdateUserLastSeen(ctx context.Context, req *user.UpdateUserLastSeenReq) (*user.Empty, error)

func (*UserService) ValidateUserPassword

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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