usecase

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package usecase implements the user business logic and orchestrates user domain operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OutboxEventRepository

type OutboxEventRepository interface {
	Create(ctx context.Context, event *outboxDomain.OutboxEvent) error
	GetPendingEvents(ctx context.Context, limit int) ([]*outboxDomain.OutboxEvent, error)
	Update(ctx context.Context, event *outboxDomain.OutboxEvent) error
}

OutboxEventRepository interface defines outbox event repository operations

type RegisterUserInput

type RegisterUserInput struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

RegisterUserInput contains the input data for user registration

type UseCase added in v1.2.0

type UseCase interface {
	RegisterUser(ctx context.Context, input RegisterUserInput) (*domain.User, error)
	GetUserByEmail(ctx context.Context, email string) (*domain.User, error)
	GetUserByID(ctx context.Context, id uuid.UUID) (*domain.User, error)
}

UseCase defines the interface for user business logic operations

func NewUserUseCase

func NewUserUseCase(
	txManager database.TxManager,
	userRepo UserRepository,
	outboxRepo OutboxEventRepository,
) (UseCase, error)

NewUserUseCase creates a new UserUseCase

type UserRepository

type UserRepository interface {
	Create(ctx context.Context, user *domain.User) error
	GetByID(ctx context.Context, id uuid.UUID) (*domain.User, error)
	GetByEmail(ctx context.Context, email string) (*domain.User, error)
}

UserRepository interface defines user repository operations

type UserUseCase

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

UserUseCase handles user-related business logic

func (*UserUseCase) GetUserByEmail

func (uc *UserUseCase) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)

GetUserByEmail retrieves a user by email

func (*UserUseCase) GetUserByID

func (uc *UserUseCase) GetUserByID(ctx context.Context, id uuid.UUID) (*domain.User, error)

GetUserByID retrieves a user by ID

func (*UserUseCase) RegisterUser

func (uc *UserUseCase) RegisterUser(ctx context.Context, input RegisterUserInput) (*domain.User, error)

RegisterUser registers a new user and creates a user.created event

Jump to

Keyboard shortcuts

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