You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This is a Golang implementation of the Joy of Energy project, which provides functionality for managing meter readings, calculating energy usage, and comparing price plans.
Project Structure
src/: Source code for the application
config/: Configuration files for price plans and test data
meters/: Meter-related functionality
pricePlans/: Price plan comparison logic
readings/: Reading storage and retrieval
usage/: Usage calculation services
tests/: Unit tests for each module
Prerequisites
Go 1.21 or higher
Running the Project
Clone the repository
Navigate to the project directory
Rungo mod tidy to download dependencies
Run the application withgo run src/app.go
Running Tests
Execute all tests with:
gotest ./tests/...
Project Components
Meter Service: Manages meter creation and retrieval
Reading Service: Stores and retrieves meter readings
Price Plan Comparator: Calculates costs for different price plans
Usage Service: Calculates total energy usage for a meter