这是一个基于Go语言的学习项目,使用Gin框架搭建,集成了MySQL和Redis数据库配置。
- Go 1.20+
- Gin Web Framework
- GORM ORM
- Redis
- MySQL
go-study/
├── config/ # 配置管理
│ ├── init.go # 初始化配置
│ ├── mysql.go # MySQL数据库配置
│ ├── redis.go # Redis配置
│ ├── setting.go # 配置结构体
│ └── setting.yml # 配置文件
│
├── entity/ # 数据模型
│ └── demo.go # 示例数据模型
│
├── main.go # 应用入口
└── go.mod # 依赖管理- 安装Go (推荐1.20+版本)
- 安装MySQL
- 安装Redis
- 修改
config/setting.yml配置数据库和Redis连接信息
database:
host: 127.0.0.1
port: 3306
username: your_username
password: your_password
database: go-admin
redis:
host: 127.0.0.1
port: 6379
db: 10
password: your_redis_passwordgo mod tidy
go run main.go