diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..75cf00e4104f65232c9b030223112324581d7fbc --- /dev/null +++ b/README.en.md @@ -0,0 +1,92 @@ +# Go Micro Framework V5 - User Service + +This is a sample user service project based on Go Micro Framework V5, providing basic functionalities related to user management. + +## Project Structure + +``` +services/user-service/ +├── config/ # Configuration files directory +│ ├── app.yml # Application configuration +│ ├── consul.yml # Consul configuration +│ ├── database.yml # Database configuration +│ ├── es.yml # Elasticsearch configuration +│ ├── etcd.yml # ETCD configuration +│ ├── mongodb.yml # MongoDB configuration +│ ├── nacos.yml # Nacos configuration +│ ├── oss.yml # OSS configuration +│ └── redis.yml # Redis configuration +├── handler/ # Business logic layer +│ └── userHandler.go # User-related business logic +├── logs/ # Log files +│ ├── gorm.log # GORM logs +│ └── userService.log # Application logs +├── main.go # Application entry point +├── middlewares/ # Middleware +│ └── logWrapper.go # Logging middleware +├── models/ # Data models +│ ├── BaseModel.go # Base model +│ ├── UserAlbumModel.go # User album model +│ └── UserModel.go # User model +├── proto/ # Protocol Buffers definitions +│ ├── params.proto # Parameter definitions +│ ├── result.proto # Result definitions +│ └── user.proto # User service definition +├── tools/ # Utility classes +│ ├── appInit.go # Application initialization +│ ├── configCenter.go # Configuration center utilities +│ ├── helpers.go # Helper functions +│ ├── mysqlDB.go # MySQL database connection +│ ├── mysqlJsonLog.go # MySQL log recording +│ ├── tracer.go # Distributed tracing +│ └── zapLogger.go # Logging +├── go.mod # Go module dependencies +└── go.sum # Go module checksums +``` + +## Features + +- User Management: Supports user creation, deletion, update, and query operations +- User Status Management: Supports enabling/disabling user accounts +- User Album Management: Supports adding and querying user albums +- Password Management: Supports user password changes +- Paginated Queries: Supports paginated querying of user lists +- Statistics: Supports retrieving statistics such as total user count +- Distributed Tracing: Integrated with Jaeger for distributed tracing +- Logging: Comprehensive logging capabilities +- Configuration Management: Supports multiple configuration centers (Consul, Nacos, etc.) + +## Technology Stack + +- Go Micro Framework V5: Microservices framework +- GORM: ORM framework +- Protocol Buffers: Interface definition and data serialization +- Zap: High-performance logging +- Jaeger: Distributed tracing +- MySQL: Database storage +- Redis: Caching support +- Consul/ETCD/Nacos: Service discovery and configuration management + +## Installation and Running + +1. Ensure Go 1.16+ and necessary dependencies are installed +2. Install dependencies: `go mod download` +3. Configure databases and other services (MySQL, Redis, Consul, etc.) +4. Run the service: `go run main.go` + +## Usage Instructions + +After starting the service, you can invoke various user service functionalities through the gRPC interface. The specific interface definitions are in the `proto/user.proto` file. + +## Contribution Guidelines + +Contributions of code and improvements are welcome. Please follow these steps: + +1. Fork this repository +2. Create a new branch +3. Commit your code changes +4. Create a Pull Request + +## License + +This project is licensed under the Apache-2.0 License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3b6f086816e32d5a506035867e9d751632119172 --- /dev/null +++ b/README.md @@ -0,0 +1,96 @@ +The repository does not contain a README.md file. I will generate one based on the project structure and code map provided. + +```markdown +# Go Micro Framework V5 - User Service + +这是一个基于 Go Micro Framework V5 的用户服务示例项目,提供了用户管理相关的基础功能。 + +## 项目结构 + +``` +services/user-service/ +├── config/ # 配置文件目录 +│ ├── app.yml # 应用配置 +│ ├── consul.yml # Consul 配置 +│ ├── database.yml # 数据库配置 +│ ├── es.yml # Elasticsearch 配置 +│ ├── etcd.yml # ETCD 配置 +│ ├── mongodb.yml # MongoDB 配置 +│ ├── nacos.yml # Nacos 配置 +│ ├── oss.yml # OSS 配置 +│ └── redis.yml # Redis 配置 +├── handler/ # 业务处理层 +│ └── userHandler.go # 用户相关业务处理 +├── logs/ # 日志文件 +│ ├── gorm.log # GORM 日志 +│ └── userService.log # 应用日志 +├── main.go # 应用入口 +├── middlewares/ # 中间件 +│ └── logWrapper.go # 日志中间件 +├── models/ # 数据模型 +│ ├── BaseModel.go # 基础模型 +│ ├── UserAlbumModel.go # 用户相册模型 +│ └── UserModel.go # 用户模型 +├── proto/ # Protocol Buffers 定义 +│ ├── params.proto # 参数定义 +│ ├── result.proto # 结果定义 +│ └── user.proto # 用户服务定义 +├── tools/ # 工具类 +│ ├── appInit.go # 应用初始化 +│ ├── configCenter.go # 配置中心工具 +│ ├── helpers.go # 辅助函数 +│ ├── mysqlDB.go # MySQL 数据库连接 +│ ├── mysqlJsonLog.go # MySQL 日志记录 +│ ├── tracer.go # 分布式追踪 +│ └── zapLogger.go # 日志记录 +├── go.mod # Go 模块依赖 +└── go.sum # Go 模块校验 +``` + +## 功能特性 + +- 用户管理:支持用户的增删改查操作 +- 用户状态管理:支持启用/禁用用户账户 +- 用户相册管理:支持用户相册的添加和查询 +- 密码管理:支持用户密码修改 +- 分页查询:支持用户列表的分页查询 +- 统计功能:支持获取用户总数等统计信息 +- 分布式追踪:集成 Jaeger 分布式追踪 +- 日志记录:详细的日志记录功能 +- 配置管理:支持多种配置中心(Consul, Nacos 等) + +## 技术栈 + +- Go Micro Framework V5:微服务框架 +- GORM:ORM 框架 +- Protocol Buffers:接口定义和数据序列化 +- Zap:高性能日志记录 +- Jaeger:分布式追踪 +- MySQL:数据库存储 +- Redis:缓存支持 +- Consul/ETCD/Nacos:服务发现和配置管理 + +## 安装与运行 + +1. 确保已安装 Go 1.16+ 和必要的依赖 +2. 安装依赖:`go mod download` +3. 配置数据库和其他服务(MySQL, Redis, Consul 等) +4. 运行服务:`go run main.go` + +## 使用说明 + +服务启动后,可以通过 gRPC 接口调用用户服务的各种功能。具体的接口定义在 `proto/user.proto` 文件中。 + +## 贡献指南 + +欢迎贡献代码和改进。请遵循以下步骤: + +1. Fork 本仓库 +2. 创建新分支 +3. 提交代码更改 +4. 创建 Pull Request + +## 许可证 + +本项目采用 Apache-2.0 许可证。 +``` \ No newline at end of file