Payments
Table of Contents
Project purpose
Payment system, provides ability to transfer money between accounts.
System also provide reports:
- all registered accounts;
- all registered payments (transfers).
API Documentation see here
Usage
Command-line flags
- Web server:
-http_address string -- Http address for web server running (default "0.0.0.0:8080")
- Database:
-db_address string -- Address to connect to PostgreSQL server (default "localhost:5432")
-database string -- PostgreSQL database name (default "payments")
-db_user string -- PostgreSQL connection user (default "postgres")
-db_password string -- PostgreSQL connection password
-pool_size int -- PostgreSQL connection pool size (default 10)
-app_name string -- PostgreSQL application name (for logging) (default "payments")
-db_log -- Switch for statements logging
Dependencies
- go-kit -- toolkit for building microservices, recommended by design;
- govalidator -- package of validators and sanitizers for strings,
numerical, slices and structures;
- decimal -- arbitrary-precision fixed-point decimal numbers in go;
- uuid -- go package for UUIDs based on RFC 4122 and DCE 1.1;
- gorilla/mux -- a powerful HTTP router and URL matcher for building Go web servers;
- prometheus client -- prometheus instrumentation library for Go
applications;
- go-cmp -- package for comparing Go values in tests;
- go-pg -- golang ORM with focus on PostgreSQL features and performance.
How to set up
Step 1. Build docker image
docker build -t payments-app .
Step 2. Run it
docker run --rm -p 8099:8080 payments-app --db_address=192.168.0.1:5432 --db_password=${DB_PASSWORD}
How to run tests
go test -race ./...
How to run code linting
golangci-lint run --presets=bugs,complexity,format
How to Contribute
We definitely welcome patches and contribution to this project!
Support
If you do have a contribution to the package, feel free to create a Pull Request or an Issue.
What to contribute
If you don't know what to do, there are some features and functions that need to be done
- Refactor code
- Edit docs and README: spellcheck, grammar and typo check
- Create actual list of contributors and projects that currently using this package
- Resolve issues and bugs
- Implement benchmarking
- Implement batch of examples
- Look at forks for new features and fixes
Advice
Feel free to create what you want, but keep in mind when you implement new features:
- Code must be clear and readable, names of variables/constants clearly describes what they are doing
- Public functions must be documented and described in source file
- There are must be unit-tests for any new functions and improvements