account/

directory
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

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:

  1. Request Event: Operation initiated (e.g., DepositRequested)
  2. Validation: Input validation and business rules
  3. Processing: Core business logic
  4. Persistence: State changes saved
  5. 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 ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

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