Skip to content

Commit a0a9b79

Browse files
committed
feat: initialize the gmicro
1 parent 8f77ada commit a0a9b79

File tree

144 files changed

+18473
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+18473
-0
lines changed

.golangci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
run:
2+
timeout: 5m
3+
modules-download-mode: readonly
4+
5+
govet:
6+
disable-all: true
7+
# Enable analyzers by name (in addition to default).
8+
# Run `go tool vet help` to see all analyzers.
9+
# Default: []
10+
enable:
11+
- printf
12+
13+
linters:
14+
disable-all: true
15+
enable:
16+
- errcheck
17+
- goimports
18+
- gofmt
19+
- govet
20+
- staticcheck
21+
22+
issues:
23+
exclude-use-default: false
24+
max-issues-per-linter: 0
25+
max-same-issues: 0

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,92 @@
11
# gmicro
22
Microservice framework implemented based on Golang.
3+
4+
## Features
5+
微服务框架:
6+
抽取出公共的服务,快速的启动项目,当需要某些功能的时候通过配置文件或者具体的实现接口
7+
微服务框架抽取出来的是业务无关的功能
8+
- 微服务的技术选型:
9+
http - gin
10+
rpc - gRPC
11+
12+
- 服务启动的时候做什么:
13+
1. rpc 服务的启动所需组件
14+
2. 处理 web 服务的启动所需组件、recovery 拦截器
15+
3. 如果希望系统可以被监控 - 需要实现 pprof 接口
16+
4. 自启动 metrics 的接口
17+
5. 可以自注册 health 接口(gRPC,http)
18+
6. app 与 gin 以及 grpc 解耦
19+
7. 完成自动服务注册(可选)
20+
8. 优雅退出
21+
9. 启动过程中的日志打印
22+
10. go-zero 中处理的信号 – 某些信号产生后在退出前会写入当前的进行的信息(信号量应该由使用者确定)
23+
24+
## Framework
25+
```shell
26+
├─api 存放与外部交互的接口及 proto 文件
27+
│ └─user
28+
│ └─v1
29+
├─app 具体服务相关的实现
30+
│ ├─pkg 服务共通的包
31+
│ │ └─code 服务的错误码
32+
│ └─user 举例 user 服务
33+
│ └─srv
34+
│ ├─config 服务的配置项,Log error 等子服务的相关逻辑全部注册到配置中
35+
│ ├─controller 表示层
36+
│ │ └─user
37+
│ ├─data 数据访问层:数据库,缓存,消息队列等,无业务逻辑
38+
│ │ └─v1
39+
│ │ ├─db
40+
│ │ └─mock
41+
│ └─service 业务逻辑层
42+
│ └─v1
43+
├─cmd 服务启动入口
44+
│ └─user 启动示例 user 服务
45+
├─configs 配置文件
46+
├─gmicro
47+
│ ├─app 服务启动相关的结构体
48+
│ └─registry 服务实例注册信息相关结构体
49+
├─pkg
50+
│ ├─app
51+
│ ├─common 共通相关的包
52+
│ │ ├─auth
53+
│ │ ├─cli
54+
│ │ │ ├─flag
55+
│ │ │ └─globalflag
56+
│ │ ├─core
57+
│ │ ├─json
58+
│ │ ├─meta
59+
│ │ │ └─v1
60+
│ │ ├─runtime
61+
│ │ ├─scheme
62+
│ │ ├─selection
63+
│ │ ├─term
64+
│ │ ├─time
65+
│ │ ├─tools
66+
│ │ ├─util
67+
│ │ │ ├─clock 时间相关的工具
68+
│ │ │ ├─fileutil
69+
│ │ │ ├─homedir
70+
│ │ │ ├─idutil
71+
│ │ │ ├─iputil
72+
│ │ │ ├─jsonutil
73+
│ │ │ ├─net
74+
│ │ │ ├─retryutil
75+
│ │ │ ├─runtime
76+
│ │ │ ├─sets
77+
│ │ │ ├─signals
78+
│ │ │ ├─sliceutil
79+
│ │ │ ├─stringutil
80+
│ │ │ └─wait
81+
│ │ ├─validation
82+
│ │ │ └─field
83+
│ │ └─version
84+
│ │ └─verflag
85+
│ ├─errors 基础的 error 包 可以单独使用
86+
│ └─log 基础的 error 包 可以单独使用
87+
└─tools 工具包
88+
└─codegen errorCode 代码生成工具
89+
```
90+
91+
92+

0 commit comments

Comments
 (0)