# user-management **Repository Path**: th0885/user-management ## Basic Information - **Project Name**: user-management - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-11 - **Last Updated**: 2025-10-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README --- AIGC: Label: '1' ContentProducer: '001191110108MA01KP2T5U00000' ProduceID: '4d3712e3-e648-4b3f-a8f2-2d32ce34ec01' ReservedCode1: 'c3d57351-b0a1-4075-82f3-4796b5bca4cb' ContentPropagator: '001191110108MA01KP2T5U00000' PropagateID: '8dbdf20b-6644-40af-9906-16e5d0b8d0b2' ReservedCode2: 'fd4c094b-88e7-4258-9d09-26658d3c20a2' --- # 用户管理系统 一个基于Go语言开发的用户管理系统,支持MySQL、PostgreSQL和SQLite数据库。 ## 功能特性 - 用户管理:注册、登录、更新个人信息 - 角色权限管理:灵活的RBAC权限控制 - 邮箱验证:支持邮箱验证功能 - 密码重置:支持密码重置功能 - 多数据库支持:MySQL、PostgreSQL和SQLite ## 技术栈 - 后端:Go - 数据库:MySQL、PostgreSQL、SQLite - ORM:GORM - 配置管理:Viper - 日志:自定义日志包 ## 快速开始 ### 环境要求 - Go 1.16+ - MySQL 5.7+ / PostgreSQL 12+ / SQLite 3 ### 安装 1. 克隆项目 ```bash git clone https://github.com/yourusername/user-management.git cd user-management ``` 2. 安装依赖 ```bash go mod download ``` 3. 配置环境变量 ```bash cp .env.example .env ``` 4. 根据需要修改`.env`文件中的配置 ### 数据库配置 #### MySQL配置 ```env DB_DRIVER=mysql DB_HOST=localhost DB_PORT=3306 DB_USER=root DB_PASSWORD=password DB_NAME=user_management DB_CHARSET=utf8mb4 DB_PARSE_TIME=true DB_LOC=Local ``` #### PostgreSQL配置 ```env DB_DRIVER=postgres DB_HOST=localhost DB_PORT=5432 DB_USER=postgres DB_PASSWORD=password DB_NAME=user_management DB_SSLMODE=disable DB_TIMEZONE=Asia/Shanghai ``` #### SQLite配置 ```env DB_DRIVER=sqlite DB_SQLITE_PATH=./app.db ``` ### 运行项目 ```bash go run main.go ``` ## 数据库迁移 项目支持自动数据库迁移,启动时会自动创建和更新数据库表结构。 ## 测试 运行测试: ```bash # 运行所有测试 go test ./... # 运行数据库测试 go test ./tests/ -v ``` ## 项目结构 ``` user-management/ ├── internal/ # 内部包 │ ├── config/ # 配置管理 │ ├── controllers/ # 控制器 │ ├── middleware/ # 中间件 │ ├── models/ # 数据模型 │ ├── repositories/ # 数据仓库 │ ├── routes/ # 路由 │ └── services/ # 服务 ├── pkg/ # 公共包 │ ├── database/ # 数据库连接 │ ├── email/ # 邮件服务 │ └── logger/ # 日志服务 ├── tests/ # 测试文件 ├── main.go # 主程序 ├── .env.example # 环境变量示例 └── README.md # 项目说明 ``` ## API文档 API文档请参考项目内的API文档文件或联系开发人员获取。 ## 贡献指南 1. Fork 项目 2. 创建特性分支 (`git checkout -b feature/AmazingFeature`) 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) 4. 推送到分支 (`git push origin feature/AmazingFeature`) 5. 打开 Pull Request ## 许可证 本项目采用 MIT 许可证 - 详情请查看 [LICENSE](LICENSE) 文件。 ## 联系方式 项目作者 - Your Name 邮箱 - your.email@example.com