I want to make a web application on golang using the ozzo framework. If I break the application into some packages, how can I get access to the application settings and the connection instance to the database in these packages?

How best to store my models? In a separate package in the models folder (possibly with subfolders) using the MVC pattern, or do you make completely complete packages with database access in the packages themselves?

1. Вариант /config /controllers /models /server main.go 2. Вариант /config /packages //user //posts //others... /server main.go 

In the first case, the handlers are separate, the models are separate. In the second case, the packages are full. There and processing and access to the necessary data from the database.

    1 answer 1

    Hello.

    The question of the architecture of the application, each developer decides for himself. It can be based on the features of the entire information system as a whole or on personal experience and preferences of the developer / architect.

    Personally, I would be inclined to follow the MVC architecture as the most well-established software development in the modern world.

    Try reading this series of articles . It describes the best practices of software architecture in the context of Golang. The framework should not interfere with the construction of architecture.

    • The last project implemented according to Clean Architecture, does not convey the feeling, full control of the code, separation of the domain logic from the infstruktury, easy extensibility, in general, a great thing, now I’m digging towards DDD - Pifagorych