Documentation ¶
Overview ¶
Package usecase user managing
Index ¶
- Variables
- type UserUsecase
- func (a *UserUsecase) Count(ctx context.Context, filter *user.ListFilter) (int64, error)
- func (a *UserUsecase) Delete(ctx context.Context, id uint64) error
- func (a *UserUsecase) FetchList(ctx context.Context, filter *user.ListFilter, order *user.ListOrder, ...) ([]*model.User, error)
- func (a *UserUsecase) Get(ctx context.Context, id uint64) (*model.User, error)
- func (a *UserUsecase) GetByEmail(ctx context.Context, email string) (*model.User, error)
- func (a *UserUsecase) GetByPassword(ctx context.Context, email, password string) (*model.User, error)
- func (a *UserUsecase) GetByToken(ctx context.Context, token string) (*model.User, *model.Account, error)
- func (a *UserUsecase) ResetPassword(ctx context.Context, email string) (*model.UserPasswordReset, *model.User, error)
- func (a *UserUsecase) SetPassword(ctx context.Context, userObj *model.User, password string) error
- func (a *UserUsecase) Store(ctx context.Context, userObj *model.User, password string) (uint64, error)
- func (a *UserUsecase) Update(ctx context.Context, userObj *model.User) error
- func (a *UserUsecase) UpdatePassword(ctx context.Context, token, email, password string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidPasswordResetCode = errors.New(`invalid password reset code`)
Functions ¶
This section is empty.
Types ¶
type UserUsecase ¶
type UserUsecase struct {
// contains filtered or unexported fields
}
UserUsecase provides bussiness logic for user access
func NewUserUsecase ¶
func NewUserUsecase(repo user.Repository) *UserUsecase
NewUserUsecase user implementation
func (*UserUsecase) Count ¶
func (a *UserUsecase) Count(ctx context.Context, filter *user.ListFilter) (int64, error)
Count of users by filter
func (*UserUsecase) Delete ¶
func (a *UserUsecase) Delete(ctx context.Context, id uint64) error
Delete delites record by ID
func (*UserUsecase) FetchList ¶
func (a *UserUsecase) FetchList(ctx context.Context, filter *user.ListFilter, order *user.ListOrder, page *repository.Pagination) ([]*model.User, error)
FetchList of users by filter
func (*UserUsecase) GetByEmail ¶
GetByEmail returns the group by Email if have access
func (*UserUsecase) GetByPassword ¶
func (a *UserUsecase) GetByPassword(ctx context.Context, email, password string) (*model.User, error)
GetByPassword returns user by email + password
func (*UserUsecase) GetByToken ¶
func (a *UserUsecase) GetByToken(ctx context.Context, token string) (*model.User, *model.Account, error)
GetByToken returns user + account by session token
func (*UserUsecase) ResetPassword ¶
func (a *UserUsecase) ResetPassword(ctx context.Context, email string) (*model.UserPasswordReset, *model.User, error)
ResetPassword for the exists user
func (*UserUsecase) SetPassword ¶
SetPassword for the exists user
func (*UserUsecase) Store ¶
func (a *UserUsecase) Store(ctx context.Context, userObj *model.User, password string) (uint64, error)
Store new object into database
func (*UserUsecase) UpdatePassword ¶
func (a *UserUsecase) UpdatePassword(ctx context.Context, token, email, password string) error
UpdatePassword for the exists user from reset token
Click to show internal directories.
Click to hide internal directories.