directory
Version:
v1.7.0
Opens a new window with list of versions in this module.
Published: Jan 17, 2026
License: MIT
Opens a new window with license information.
README
ΒΆ
π¦ Account Handlers
Event-driven account operation handlers following clean architecture and domain-driven design principles.
ποΈ Package Structure
account/
βββ deposit/ # Deposit operation handlers
β βββ handler.go # Event handler implementation
β βββ handler_test.go # Handler tests
β βββ validation.go # Business validation
β βββ validation_test.go # Validation tests
β
βββ withdraw/ # Withdrawal operation handlers
β βββ handler.go
β βββ handler_test.go
β βββ validation.go
β βββ validation_test.go
β
βββ transfer/ # Transfer operation handlers
β βββ handler.go
β βββ handler_test.go
β βββ validation.go
β βββ validation_test.go
β
βββ common/ # Shared components
βββ account_query_handler.go
βββ account_query_handler_test.go
βββ validator.go
βββ validator_test.go
π Key Features
- Event-Driven: Handlers respond to domain events
- Clean Architecture: Clear separation of concerns
- Testable: Comprehensive test coverage
- Modular: Independent operation handlers
- Validation: Built-in request validation
π§ͺ Testing
- Unit tests co-located with implementation
- Table-driven tests for comprehensive coverage
- Test helpers in
testutils package
- Mock implementations using
mockery
π Event Flow
Each operation follows a consistent event flow:
- Request Event: Operation initiated (e.g.,
DepositRequested)
- Validation: Input validation and business rules
- Processing: Core business logic
- Persistence: State changes saved
- Response Event: Operation result published
π Dependencies
github.com/gofiber/fiber/v2 - HTTP server
github.com/google/uuid - ID generation
github.com/stretchr/testify - Testing utilities
ποΈ Design Principles
- Single Responsibility: Each handler does one thing
- Dependency Injection: Dependencies passed explicitly
- Immutability: State changes through events
- Error Handling: Consistent error responses
Directories
ΒΆ
Click to show internal directories.
Click to hide internal directories.