summary
I'm sorry , I haven't published any articles for about ten days , My friends are all behind the scenes to urge the shift ...
I've been too busy these days , Every day Coding , In use go write API end , write Service end ...
forget it , Let's show you a picture ...
I'd like to share with you today , stay API End use Gin Frame time , List of items .
catalog
*
├─ Project Name
*
│ ├─ config // configuration file
*
│ ├── ...
*
│ ├─ controller // Controller layer
*
│ ├── ...
*
│ ├─ service // Business layer
*
│ ├── ...
*
│ ├─ repository // Database operation layer
*
│ ├── ...
*
│ ├─ model // database ORM
*
│ ├── ...
*
│ ├─ entity // entity
*
│ ├── ...
*
│ ├─ proto //proto file
*
│ ├── ...
*
│ ├─ router // route
*
│ ├── middleware // Routing Middleware
*
│ ├── ...
*
│ ├── ...
*
│ ├─ util // Tools
*
│ ├── ...
*
│ ├─ vendor // Expansion pack
*
│ ├── ...
*
│ ├─ main.go // Entry file
next , Simple explanation :
config
Write the configuration file of the project .
controller
Controller layer , Verify submitted data , Pass validation completed data to service.
service
Business layer , Only complete the development of business logic , Do not operate the database .
repository
Database operation layer , Like writing , Multi table insertion , Multi table query, etc , Do not write business code .
model
Database ORM.
entity
Write the structure of the returned data .
write controller Structure of layer method parameter verification .
proto
write gRPC Of *.pb.go file .
router
Middleware for writing routing configuration and routing ( authentication , journal , Exception capture ).
util
Write project general tool class .
vendor
Directory of the third party expansion pack .
Summary
Some code involved , I need to sort it out , I'll share it with you next time .
That's all , I'm going to move the bricks .
Technology
Daily Recommendation