fildenisov / coinconv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

coinconv

Is a test task project.

Task details

  1. Create cli utility which converts one currency into another using coinmarketcap API. Example:

    $> ./coinconv 123.45 USD BTC
    654.05
    
  2. Code should be uploaded to github.

  3. Use the test API key b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c

  4. Take care about clean architecture and SOLID principles.

Layout

/src/client/coinmarketcap

Is an auto generated REST client. Downloaded from here -> swagger

/adapter/coinmarketcap/

Is an adapter for autogenerated REST client

/internal/app

Contains an application instance and constructor for all application components

/internal/rep

Contains interfaces of all application components

/cmd/cli

Is an entrypoint to run app from console

Implementation details

  1. Entry point (cmd/cli/main.go) inits App passing app.Config. Any entrypoint current or future must not import app components directly.
  2. All componets App consists of must follow one of interfaces from internal/rep.
  3. adapter/coinmarketcap imports src/client/coinmarketcap directly, it's OK, because this is just a decorator for autogenerated client.
  4. Application has no models, because passing arguments and reciving values of interfaces are primitive. Add ./models/... if you'll need to share complex data between app components.
  5. Application has no usecase or domain package because no complex highlevel logic is required yet. We just build app based on console input, send one request to Converter components and returns the result back to the console.

About


Languages

Language:Go 100.0%Language:Shell 0.0%Language:Makefile 0.0%