Documentation
¶
Overview ¶
Package user provides business logic for user management operations. It uses the decorator pattern for transaction management and includes comprehensive logging.
Index ¶
- type Service
- func (s *Service) CreateUser(ctx context.Context, username, email, password string) (u *user.User, err error)
- func (s *Service) DeleteUser(ctx context.Context, userID string) (err error)
- func (s *Service) GetUser(ctx context.Context, userID string) (u *dto.UserRead, err error)
- func (s *Service) GetUserByEmail(ctx context.Context, email string) (u *dto.UserRead, err error)
- func (s *Service) GetUserByUsername(ctx context.Context, username string) (u *dto.UserRead, err error)
- func (s *Service) UpdateUser(ctx context.Context, userID string, update *dto.UserUpdate) (err error)
- func (s *Service) ValidUser(ctx context.Context, identifier string, password string) (valid bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides business logic for user operations including creation, updates, and deletion.
func New ¶ added in v1.2.0
func New( uow repository.UnitOfWork, logger *slog.Logger, ) *Service
New creates a new Service with a UnitOfWork and logger.
func (*Service) CreateUser ¶
func (s *Service) CreateUser( ctx context.Context, username, email, password string, ) (u *user.User, err error)
CreateUser creates a new user account in a transaction.
func (*Service) DeleteUser ¶
DeleteUser deletes a user account in a transaction.
func (*Service) GetUserByEmail ¶
GetUserByEmail retrieves a user by email in a transaction.
func (*Service) GetUserByUsername ¶
func (s *Service) GetUserByUsername( ctx context.Context, username string, ) (u *dto.UserRead, err error)
GetUserByUsername retrieves a user by username in a transaction.
func (*Service) UpdateUser ¶
func (s *Service) UpdateUser( ctx context.Context, userID string, update *dto.UserUpdate, ) (err error)
UpdateUser updates user information in a transaction.
Click to show internal directories.
Click to hide internal directories.