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 ¶
GetUserByEmail retrieves a user by email
func (*UserUseCase) GetUserByID ¶
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
Click to show internal directories.
Click to hide internal directories.