Project strcture
project-root-directory/
├── internal/
│ ├── session/
│ │ ├── runner/
│ │ │ ├── null.go
│ │ │ ├── runner.go
│ │ │ ├── sql.go
│ │ │ └── source/
│ │ │ ---├── mysql.go
│ │ │ ---├── sql.go
│ │ │ ---└── source.go
│ │ └── cache/
│ └── database/
│ ---├── database.go
│ ---└── mysql.go
Interfaces:
database source runner
The main functionality revolves around 'runner' and 'source', with 'mysql' as the implementation. There will also be 'mysql' used for storage, so I want to clearly distinguish between when I'm calling storage and when I'm calling the database.
I've been adjusting the structure for two days now.I plan to add many more runners and databases.
I'm considering creating subfolders inside 'runner', but the structures they implement are 'runner'. It might become confusing, especially since I'll be using 'mysql' for storage as well. and I really dont want it to be called as mysql.Mysql and prefer it will be called runner.Mysql.
But I am afraid of a large package size but I really dont want sttr mysql.Mysql for each struct
Someone suggested """ I would create a runner repository inside the internal/session/runner (same for source)
Then implement the repository somewhere inside internal/mysql/runner.go and internal/mysql/source.go
"""
TBH I think it will problay what I will do
Aucun commentaire:
Enregistrer un commentaire