user

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package user provides business logic for user management operations. It uses the decorator pattern for transaction management and includes comprehensive logging.

Index

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

func (s *Service) DeleteUser(
	ctx context.Context,
	userID string,
) (err error)

DeleteUser deletes a user account in a transaction.

func (*Service) GetUser

func (s *Service) GetUser(
	ctx context.Context,
	userID string,
) (u *dto.UserRead, err error)

GetUser retrieves a user by ID in a transaction.

func (*Service) GetUserByEmail

func (s *Service) GetUserByEmail(
	ctx context.Context,
	email string,
) (u *dto.UserRead, err error)

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.

func (*Service) ValidUser

func (s *Service) ValidUser(
	ctx context.Context,
	identifier string,
	password string,
) (
	valid bool,
	err error,
)

ValidUser validates user credentials in a transaction.

Jump to

Keyboard shortcuts

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