Documentation
¶
Overview ¶
Package usecase user managing
Index ¶
- Variables
- func NewEmailUsecase[T user.EmailCapableModel](emailRepo user.EmailRepository[T], _ func() T) user.EmailUsecase[T]
- func NewPasswordUsecase[T user.PasswordCapableModel](core user.Usecase[T], passRepo user.PasswordRepository[T]) user.PasswordUsecase[T]
- func NewUsecase[T user.Model](repo user.Repository[T]) user.Usecase[T]
- type EmailUsecase
- type PasswordUsecase
- func (a *PasswordUsecase[T]) ChangePassword(ctx context.Context, currentPassword, newPassword string) error
- func (a *PasswordUsecase[T]) Repo() user.PasswordRepository[T]
- func (a *PasswordUsecase[T]) ResetPassword(ctx context.Context, userID uint64) (*user.UserPasswordReset, T, error)
- func (a *PasswordUsecase[T]) SetPassword(ctx context.Context, userObj T, password string) error
- func (a *PasswordUsecase[T]) UpdatePassword(ctx context.Context, userID uint64, token, password string) error
- type UserUsecase
- func (a *UserUsecase[T]) Count(ctx context.Context, opts ...user.QOption) (int64, error)
- func (a *UserUsecase[T]) Create(ctx context.Context, userObj T) (uint64, error)
- func (a *UserUsecase[T]) Delete(ctx context.Context, id uint64) error
- func (a *UserUsecase[T]) EmptyObject() T
- func (a *UserUsecase[T]) FetchList(ctx context.Context, opts ...user.QOption) ([]T, error)
- func (a *UserUsecase[T]) Get(ctx context.Context, id uint64) (T, error)
- func (a *UserUsecase[T]) Update(ctx context.Context, userObj T) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewEmailUsecase ¶ added in v0.5.0
func NewEmailUsecase[T user.EmailCapableModel](emailRepo user.EmailRepository[T], _ func() T) user.EmailUsecase[T]
NewEmailUsecase creates email usecase.
func NewPasswordUsecase ¶ added in v0.5.0
func NewPasswordUsecase[T user.PasswordCapableModel](core user.Usecase[T], passRepo user.PasswordRepository[T]) user.PasswordUsecase[T]
NewPasswordUsecase creates password usecase.
func NewUsecase ¶ added in v0.5.0
NewUsecase creates generic core user usecase.
Types ¶
type EmailUsecase ¶ added in v0.5.0
type EmailUsecase[T user.EmailCapableModel] struct { // contains filtered or unexported fields }
EmailUsecase provides email lookup business logic.
func (*EmailUsecase[T]) GetByEmail ¶ added in v0.5.0
func (a *EmailUsecase[T]) GetByEmail(ctx context.Context, email string) (T, error)
GetByEmail retrieves user by email (case-insensitive) with access control check.
type PasswordUsecase ¶ added in v0.5.0
type PasswordUsecase[T user.PasswordCapableModel] struct { // contains filtered or unexported fields }
PasswordUsecase provides password business logic.
func (*PasswordUsecase[T]) ChangePassword ¶ added in v0.5.0
func (a *PasswordUsecase[T]) ChangePassword(ctx context.Context, currentPassword, newPassword string) error
ChangePassword changes the password for the current user with access control check.
func (*PasswordUsecase[T]) Repo ¶ added in v0.5.0
func (a *PasswordUsecase[T]) Repo() user.PasswordRepository[T]
Repo returns the underlying password repository.
func (*PasswordUsecase[T]) ResetPassword ¶ added in v0.5.0
func (a *PasswordUsecase[T]) ResetPassword(ctx context.Context, userID uint64) (*user.UserPasswordReset, T, error)
ResetPassword generates a password reset token for the user with access control check.
func (*PasswordUsecase[T]) SetPassword ¶ added in v0.5.0
func (a *PasswordUsecase[T]) SetPassword(ctx context.Context, userObj T, password string) error
SetPassword sets a new password for the user with access control check.
func (*PasswordUsecase[T]) UpdatePassword ¶ added in v0.5.0
func (a *PasswordUsecase[T]) UpdatePassword(ctx context.Context, userID uint64, token, password string) error
UpdatePassword updates the password for the user using a reset token with access control check.
type UserUsecase ¶
UserUsecase provides business logic for user access.
func (*UserUsecase[T]) Create ¶ added in v0.4.0
func (a *UserUsecase[T]) Create(ctx context.Context, userObj T) (uint64, error)
func (*UserUsecase[T]) Delete ¶
func (a *UserUsecase[T]) Delete(ctx context.Context, id uint64) error
func (*UserUsecase[T]) EmptyObject ¶ added in v0.5.0
func (a *UserUsecase[T]) EmptyObject() T