refatorando a arquitetura
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"controle-de-estoque/internal/cli"
|
||||
inmemory "controle-de-estoque/internal/repository/in_memory"
|
||||
"controle-de-estoque/internal/service"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Aqui é o único lugar que "conhece" todas as camadas.
|
||||
// Para trocar a persistência (ex: Postgres, arquivo JSON),
|
||||
// basta trocar esta linha por outra implementação de
|
||||
// repository.InventoryRepository — nada mais muda.
|
||||
repo := inmemory.NewInventorytRepository()
|
||||
|
||||
svc := service.NewInventoryService(repo)
|
||||
|
||||
app := cli.NewApp(svc)
|
||||
app.Run()
|
||||
}
|
||||
Reference in New Issue
Block a user