Skip to content

Commit 92c8d68

Browse files
committed
DDD(领域设计驱动)+六边形架构
1 parent d16145c commit 92c8d68

File tree

18 files changed

+139
-107
lines changed

18 files changed

+139
-107
lines changed

README.md

Lines changed: 109 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## learning_tools [源码地址](https://github.com/hwholiday/learning_tools)
22

3-
# go-kit 微服务实践,从入门到精通系列
3+
# go-kit 微服务实践,从入门到精通系列
4+
45
### [go-kit](https://github.com/hwholiday/learning_tools/tree/master/go-kit) (go-kit微服务)
6+
57
1: v1 go-kit 微服务 基础使用 (HTTP)
68
2: v2 go-kit 微服务 添加日志(user/zap ,并为每个请求添加UUID)
79
3: v3 go-kit 微服务 身份认证 (JWT)
@@ -14,11 +16,14 @@
1416
10: v9 go-kit 微服务 服务链路追踪(jaeger 实现)(2)
1517
11: v11 go-kit 微服务 添加一个简单网关
1618

17-
1819
# gRPC负载均衡(自定义负载均衡策略--etcd 实现)
20+
1921
### [hlb-grpc](https://github.com/hwholiday/learning_tools/tree/master/hlb-grpc) (gRPC负载均衡(自定义负载均衡策略--etcd 实现)
22+
2023
##### 实现基于版本(version)的grpc负载均衡器,了解过程后可自己实现更多的负载均衡功能
24+
2125
### [详细介绍](https://www.hwholiday.com/2021/etcd_grpc/)
26+
2227
+ 注册中心
2328
- Etcd Lease 是一种检测客户端存活状况的机制。 群集授予具有生存时间的租约。 如果etcd 群集在给定的TTL 时间内未收到keepAlive,则租约到期。 为了将租约绑定到键值存储中,每个key 最多可以附加一个租约
2429
+ 服务注册 (注册服务)
@@ -48,89 +53,50 @@
4853
└── register_test.go
4954
5055
```
56+
5157
# 仿微信 auth2 授权登陆
58+
5259
##### DDD(领域设计驱动)+六边形架构
53-
### [auth2](https://github.com/hwholiday/learning_tools/tree/master/ddd-auth2-example)
60+
61+
### [AUTH2](https://github.com/hwholiday/learning_tools/tree/master/ddd-auth2-example) (auth2 授权码模式)
62+
63+
# Golang DDD 的项目分层结构(六边形架构)
64+
65+
### [AUTH2](https://github.com/hwholiday/learning_tools/tree/master/ddd-project-example) (DDD 项目分层结构)
66+
5467
```base
55-
.
56-
├── adpter
57-
│   ├── adpter.go
68+
├── cmd 存放 main.go 等
69+
├── adapter
70+
│   ├── grpc
5871
│   └── http
59-
│   ├── auth_handles
60-
│   │   ├── auth_code_handles.go
61-
│   │   ├── auth_token_handles.go
62-
│   │   └── handers.go
63-
│   ├── http.go
64-
│   └── routers
65-
│   ├── middleware.go
66-
│   └── routers.go
67-
├── cmd
68-
│   ├── app.yaml
69-
│   ├── cmd
70-
│   ├── main.go
71-
│   ├── wire_gen.go
72-
│   └── wire.go
72+
│   └── facade 引用其他微服务(接口防腐层)
73+
├── application
74+
│   ├── assembler 负责将内部领域模型转化为可对外的DTO
75+
│   └── cqe Command、Query和Event -- 入参
76+
│   └── dto Application层的所有接口返回值为DTO -- 出参
77+
│   └── service 负责业务流程的编排,但本身不负责任何业务逻辑
7378
├── domain
74-
│   ├── aggregate
75-
│   │   ├── auth_code.go
76-
│   │   ├── auth_factory.go
77-
│   │   ├── auth_token.go
78-
│   │   ├── auth_token_produce.go
79-
│   │   └── factory.go
80-
│   ├── dto
81-
│   │   ├── auth_code.go
82-
│   │   ├── auth_token.go
83-
│   │   └── user.go
84-
│   ├── entity
85-
│   │   └── merchant.go
86-
│   ├── obj
87-
│   │   ├── auth_code.go
88-
│   │   └── auth_token.go
89-
│   ├── repo
90-
│   │   ├── auth_code.go
91-
│   │   ├── auth_token.go
92-
│   │   ├── merchant.go
93-
│   │   └── specification
94-
│   │   ├── auth_code_by_code.go
95-
│   │   ├── auth_token_by_code.go
96-
│   │   └── merchant_by_appid.go
97-
│   └── service
98-
│   ├── auth_code.go
99-
│   ├── auth_token.go
100-
│   ├── merchant.go
101-
│   └── service.go
102-
├── infrastructure
103-
│   ├── conf
104-
│   │   ├── auth_consts.go
105-
│   │   └── conf.go
106-
│   ├── pkg
107-
│   │   ├── database
108-
│   │   │   ├── mongo
109-
│   │   │   │   └── mgo.go
110-
│   │   │   └── redis
111-
│   │   │   ├── lock.go
112-
│   │   │   ├── redis.go
113-
│   │   ├── hcode
114-
│   │   │   ├── base.go
115-
│   │   │   └── code.go
116-
│   │   ├── log
117-
│   │   │   └── zap.go
118-
│   │   └── tool
119-
│   │   ├── aes.go
120-
│   │   ├── aes_test.go
121-
│   │   ├── jwt.go
122-
│   │   └── jwt_test.go
123-
│   └── repository
124-
│   ├── atuh_code.go
125-
│   ├── atuh_token.go
126-
│   ├── merchant.go
127-
│   └── repository.go
128-
└── README.md
129-
79+
│   ├── aggregate 聚合
80+
│   ├── entity 实体
81+
│   ├── event 事件
82+
│   │   ├── publish
83+
│   │   └── subsctibe
84+
│   ├── repo 接口
85+
│   │   └── specification 统一封装查询
86+
│   ├── service 领域服务
87+
│   └── vo 值对象
88+
└── infrastructure
89+
├── config 配置文件
90+
├── pkg 常用工具类封装(DB,log,tool等)
91+
└── repository
92+
├── converter domain内对象转化 do {互转}
93+
└── do 数据库映射对象
13094
```
131-
# go_push 一个实用的消息推送服务
95+
96+
# go_push 一个实用的消息推送服务
97+
13298
### [go_push](https://github.com/hwholiday/learning_tools/tree/master/go_push) (推送服务)
133-
99+
134100
```base
135101
├── gateway // 长连接网关服务器
136102
│   ├── push_job.go // 分发任务
@@ -173,15 +139,16 @@ t.Log(conf)
173139
t.Log(r.Close())
174140
```
175141

176-
177142
### [micro_agent](https://github.com/hwholiday/learning_tools/tree/master/micro_agent) (micro微服务)
143+
178144
1: base 基础方法
179145
2: conf 配置文件
180146
3:handler 对外处理方法
181147
4:model 数据格式
182148
5:proto protobuf 文件
183-
149+
184150
### [project_layout](https://github.com/hwholiday/learning_tools/tree/master/project_layout) (项目结构)
151+
185152
```base
186153
详细介绍查看文件夹内README.me内容
187154

@@ -202,137 +169,172 @@ t.Log(r.Close())
202169
└─tool
203170
```
204171

205-
### [all_packaged_library](https://github.com/hwholiday/learning_tools/tree/master/all_packaged_library) 里面封装了一些常用的库,有详细的介绍,持续更新
172+
### [all_packaged_library](https://github.com/hwholiday/learning_tools/tree/master/all_packaged_library) 里面封装了一些常用的库,有详细的介绍,持续更新
173+
206174
1: base 里面封装mysql,redis,mgo,minio文件储存库S3协议,雪花算法,退出程序方法,redis全局锁,日志库等(插件形式可单独引用)
207175
2: logtool uber_zap日志库封装,可自动切分日志文件,压缩文件
208176
3: perf ppoof小插件
209177
4: push 集成苹果推送,google推送,华为推送
210178
5: quit 优雅的退出程序
211179
6: registrySelector 基于etcd实现的服务注册,发现,负载均衡
212180

213-
214-
215-
216181
### [nsq](https://github.com/hwholiday/learning_tools/tree/master/docker) (为你的服务插上docker_compose翅膀)
182+
217183
1: docker 为你的服务插上docker_compose翅膀
218-
184+
219185
### [kafka](https://github.com/hwholiday/learning_tools/tree/master/kafka) (分布式消息发布订阅系统)
186+
220187
1: main 消息队列
221-
188+
222189
### [NATS_streaming](https://github.com/hwholiday/learning_tools/tree/master/NATS_streaming) (分布式消息发布订阅系统--是由NATS驱动的数据流系统)
190+
223191
1: main 消息队列
224-
192+
225193
### [nsq](https://github.com/hwholiday/learning_tools/tree/master/kafka) (分布式实时消息平台)
194+
226195
1: main 消息队列
227-
196+
228197
### [grpc](https://github.com/hwholiday/learning_tools/tree/master/grpc) (grpc学习)
198+
229199
1: bidirectional_streaming_rpc 双向流grpc
230200
2: server_side_streaming_rpc 服务端流grpc,也可以写成客户端流grpc
231201
3: simple_rpc 简单grpc
232202

233203
### [rpc](https://github.com/hwholiday/learning_tools/tree/master/rpc) (rpc学习)
204+
234205
1: main rpc学习
235-
206+
236207
### [prometheus](https://github.com/hwholiday/learning_tools/tree/master/prometheus) (监控报警系统)
208+
237209
1: server Prometheus监控报警系统
238210

239211
### [jaeger](https://github.com/hwholiday/learning_tools/tree/master/jaeger) (jaeger分布式链路追踪)
212+
240213
1: main jaeger分布式链路追踪
241-
214+
242215
### [service_load_balancing](https://github.com/hwholiday/learning_tools/tree/master/service_load_balancing) (负载均衡)
216+
243217
1: fisher_yates_test 添加fisher-yates算法 负载均衡节点
244218

245219
### [hystrix](https://github.com/hwholiday/learning_tools/tree/master/hystrix) (熔断)
220+
246221
1: hystrix 学习并使用熔断(Hystrix)
247222

248223
### [req_limit](https://github.com/hwholiday/learning_tools/tree/master/req_limit) (限流)
224+
249225
1: main 使用带缓存的channel实现限流
250226
2: uber_ratelimit 使用uber_ratelimit实现限流
251-
227+
252228
### [ini](https://github.com/hwholiday/learning_tools/tree/master/ini) (配置文件库)
229+
253230
1: main 配置文件ini的读取,以及自动匹配到结构体里面
254-
231+
255232
### [minio](https://github.com/hwholiday/learning_tools/tree/master/minio) (对象存储服务)
233+
256234
1: minio 对象存储服务使用
257-
235+
258236
### [mysql](https://github.com/hwholiday/learning_tools/tree/master/mysql) (mysql服务器)
237+
259238
1: main 简单的mysql使用
260-
239+
261240
### [redis](https://github.com/hwholiday/learning_tools/tree/master/redis) (redis相关)
241+
262242
1: bloom_filter redis 实现BloomFilter过滤器
263243
2: lock redis实现全局锁
264244
3: pipeline redis事务
265245
4: subscription redis发布订阅
266246

267247
### [mongodb](https://github.com/hwholiday/learning_tools/tree/master/mongodb) (mongodb服务器)
248+
268249
1: mgo.v2 mgo.v2库的基础使用学习
269250
2: mongo-go-driver 官方库的demo,以及事务提交(不能是单节点)
270251

271252
### [gin](https://github.com/hwholiday/learning_tools/tree/master/gin) (web框架gin学习)
253+
272254
1: mvc 模式,swagger文档 可作为基础学习gin
273-
255+
274256
### [jwt](https://github.com/hwholiday/learning_tools/tree/master/jwt) (JSON WEB TOKEN)
257+
275258
1: jwt 学习使用
276-
259+
277260
### [zaplog](https://github.com/hwholiday/learning_tools/tree/master/kafka) (uber zap日志封装)
261+
278262
1: zap 日志封装
279263

280264
### [snow_flake](https://github.com/hwholiday/learning_tools/tree/master/snow_flake) (雪花算法)
265+
281266
1: main 雪花算法
282267

283268
### [encryption_algorithm](https://github.com/hwholiday/learning_tools/tree/master/encryption_algorithm) (双棘轮算法, KDF链,迪菲-赫尔曼棘轮,x3dh)
269+
284270
1: aes ase-(cfb,cbc,ecb)-(128,192,256)加解密方法
285271
2: curve25519 椭圆曲线算法
286272
3: 3curve25519 双棘轮算法,KDF链
287273

288274
### [LRU](https://github.com/hwholiday/learning_tools/tree/master/LRU) (缓存淘汰算法)
275+
289276
1: list lru 缓存淘汰算法
290-
277+
291278
### [tcp](https://github.com/hwholiday/learning_tools/tree/master/tcp) (tcp协议实现)
279+
292280
1: 实现网络库,封包,解包 len+tag+data 模式
293-
281+
294282
### [websocket](https://github.com/hwholiday/learning_tools/tree/master/websocket) (websocket协议实现)
283+
295284
1: 实现网络库
296-
285+
297286
### [binary_conversion](https://github.com/hwholiday/learning_tools/tree/master/tool/binary_conversion) (进制转换)
287+
298288
1: 10to36 10进制转36进制
299289
2: 10to62 10进制转62进制
300290
3: 10to76 10进制转76进制
301291
4: binary 用一个int64来描述开关(用户设置很多建议使用)
302292

303293
### [job_worker_mode](https://github.com/hwholiday/learning_tools/tree/master/job_worker_mode) (job_worker模式)
294+
304295
1: worker job_worker模式,可提高系统吞吐量
305296

306297
### [filewatch](https://github.com/hwholiday/learning_tools/tree/master/filewatch) (监控文件变化)
298+
307299
1: main 监控文件变化 可实现自动构建
308300

309301
### [push](https://github.com/hwholiday/learning_tools/tree/master/prometheus) (一个简单的推送服务)
302+
310303
1: main 推送服务
311-
304+
312305
### [goquery](https://github.com/hwholiday/learning_tools/tree/master/goquery) (网页解析工具)
306+
313307
1: main 可以作为爬虫解析网页使用
314-
308+
315309
### [active_object](https://github.com/hwholiday/learning_tools/tree/master/active_object) (并发设计模式)
310+
316311
1: active_object Go并发设计模式之Active Object
317-
312+
318313
### [heap](https://github.com/hwholiday/learning_tools/tree/master/container/heap) (优先级队列)
314+
319315
1: heap 利用heap创建一个优先级队列
320-
316+
321317
### [cli](https://github.com/hwholiday/learning_tools/tree/master/cli) (go命令行交互)
318+
322319
1: main go命令行交互
323-
320+
324321
### [context](https://github.com/hwholiday/learning_tools/tree/master/context) (context包学习)
322+
325323
1: main context包学习
326-
324+
327325
### [err](https://github.com/hwholiday/learning_tools/tree/master/err) (error 相关)
326+
328327
1: main golang 1.13 error 相关
329-
328+
330329
### [interface](https://github.com/hwholiday/learning_tools/tree/master/interface) (interface包学习)
330+
331331
1: main interface包学习
332332
2: middleware Golang 基于interface 实现中间件
333-
333+
334334
### [syncPool](https://github.com/hwholiday/learning_tools/tree/master/syncPool) (syncPool包学习)
335+
335336
1: main syncPool包学习
336337

337338
### [reflect](https://github.com/hwholiday/learning_tools/tree/master/reflect) (reflect包学习)
339+
338340
1: main reflect包学习

0 commit comments

Comments
 (0)