cleanstack

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

cleanstack

cleanstack is an attempt of implementing clean architecture in go project

the concept introduce by Robert C. Martin (Uncle Bob) more at : https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html

Description

Rules Of clean architecture are :

  • Independent of Frameworks. The architecture does not depend on the existence of some library of feature laden software. This allows you to use such frameworks as tools, rather than having to cram your system into their limited constraints.
  • Testable. The business rules can be tested without the UI, Database, Web Server, or any other external element.
  • Independent of UI. The UI can change easily, without changing the rest of the system. A Web UI could be replaced with a console UI, for example, without changing the business rules.
  • Independent of Database. You can swap out Oracle or SQL Server, for Mongo, BigTable, CouchDB, or something else. Your business rules are not bound to the database.
  • Independent of any external agency. In fact your business rules simply don’t know anything at all about the outside world.

Project cleanstack

This project has 4 Domain layer :

  • Domain Layer
  • Repository Layer
  • Usecase Layer
  • Presenter Layer

clean architecture

Domain Layer

domain layer will used in all layer. this layer will store any presenter api contract, it also acts as entity / model for the repository.

Repository Layer

Repository will store any Database handler. Querying, or Creating/ Inserting into any database will stored here. This layer will act for CRUD to database only. No business process happen here. Only plain function to Database.

Usecase Layer

This layer will act as the business process handler. Any process will handled here. This layer will decide, which repository layer will use. And have responsibility to provide data to serve into delivery. Process the data doing calculation or anything will done here.

Presenter Layer

This layer will act as the presenter. Decide how the data will presented. Could be as REST API, or HTML File, or gRPC whatever the delivery type. Validate the input and sent it to Usecase layer.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
pkg
datasources/mysql
Package mysql storage is designed to give lazy load singleton access to mysql connections it doesn't provide any cluster nor balancing support, assuming it is handled in lower level infra, i.e.
Package mysql storage is designed to give lazy load singleton access to mysql connections it doesn't provide any cluster nor balancing support, assuming it is handled in lower level infra, i.e.

Jump to

Keyboard shortcuts

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