HelloAdmin
发布时间 2023年11月14日 (更新时间 2024年4月1日) • 1 分钟 读完 • 155 字HelloAdmin 是一个基于 Gin + Ant Design Vue UI 的前后端分离管理系统

thumbnail image prompt:background: A butterfly is on a flower in the warm sunlight ,frontend text: “HelloAdmin”
HelloAdmin 是一个基于 Gin + Ant Design Vue UI 的前后端分离管理系统,前端使用 Ant Design Vue UI,后端使用 Gin 框架。
受 go-clean-template 项目启发,如何组织Go项目,以防止项目演化成难以维护的代码,使用 Go 社区库,组织了该项目,借助 AI Coding,重新组织了项目工程结构可用于新项目组的 Go 脚手架工具。
该项目使用四层架构,常规无论是 PHP 框架还是 Java,基本 MVC 三层思想已经深入我们的心中,但是 Go 项目如果像 PHP、Java 项目一样组织代码,开发过程中将是很痛苦的一件事,目录中跳来跳去,这让我觉得很麻烦。
于是在借鉴 go-clean-template 项目思想,我做了以下两个方向的主要改造:
├── internal
│ ├── department
│ │ ├── api_types.go
│ │ ├── handler.go
│ │ ├── model.go
│ │ ├── repository.go
│ │ └── service.go
│ ├── ecode
│ │ ├── errcode_string.go
│ │ └── error.go
│ └── user
│ ├── api_types.go
│ ├── handler.go
│ ├── model.go
│ ├── respository.go
│ └── service.go各个业务模块的代码,归在各自的工程目录,这样做的唯一好处就是很好维护,那个业务模块出了问题,可以快速定位。
HTTP > handler
handler > service > repository (repo)
handler < service < repository (repo)
handler > service > repository (repo)
handler < service < repository (repo)
HTTP < handler更多,见源码地址:https://github.com/heliosker/helloadmin