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
©2019-2020 Toolsou All rights reserved,
Cheats developers apologize CCTV :Tiktok A lawsuit shows the attitude and determination of safeguarding rights Hackbar Using the tutorial MySql sentence Recursively find all subordinate departments of an input department use mt-range The effect of changing a number with the sliding bar is realized mysql Recursively finds all child nodes of the parent class Conflict statement (conflicting declaration) solve Map judge key Corresponding value Does the value exist -containsKey() mysql No backup recovery iPhone 12 price , Configure full exposure : Cut it off 64GB, Battery 2227mAh start