Skip to content

ezhdanovskiy/wallets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wallets

Components

The application has two components:

  1. postgres - database.
  2. wallets - HTTP server.

1. postgres

The database contains two tables wallets and operations.

  • wallets contains wallet name and balance.
  • operations contains deposit and withdrawal operations.

Read migrations for details.

I decided to use sql.LevelSerializable for transactions. This simplifies life on the stage of development. In the future it will be possible to try to optimize.

2. wallets

The wallets component can be run in multiple instances.
It serves four endpoints:

  • POST /wallets - Add wallet.
  • POST /wallets/deposit - Top up wallet.
  • POST /wallets/transfer - Transfer money.
  • GET /wallets/operations - Get wallet operations.

Read api/v1/swagger.yaml for details.

Packages

  • application - creates dependencies and runs application;
  • config - reads configuration from envs (viper);
  • consts - application constants;
  • csv - methods for generating csv;
  • dto - data transfer objects;
  • http - HTTP server;
  • httperr - custom errors;
  • repository - works with database;
  • service - business logic;
  • tests - integration tests.

Use go doc for details.

go doc internal/service

About

A simple wallet app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published