-
Notifications
You must be signed in to change notification settings - Fork 0
Packages and namespaces
(work in progress)
Let's say we work for a car dealership and we need to get car data from the Ford Motors API and store it in the database.
The database is straightforward: a schema called "ford" and a table called "ford.car".
Firstly, I would define the namespaces in advance, something like:
- fordapi - client code to access the Ford API
- fordcar - the store package (database access) for the table "ford.car"
- ford - core processes related to Ford
Then some notes about each in turn:
This package could be in /internal/apiclients/fordapi
This is where I would keep all client code accessing the Ford API, and structs which model the results exactly.
This package could be in /internal/stores/ford/fordcar
This store would contain all database access code for the ford.car table. I would also put business logic here if it relates directly to a Ford car.
This package could be in /internal/processes/ford
This would be the main business logic package for Ford, except logic directly related to an entity. It might contain functions for billing and reporting.