File tree 3 files changed +39
-17
lines changed
3 files changed +39
-17
lines changed Original file line number Diff line number Diff line change 1
- ## go-design-patterns
2
-
3
- Go经典设计模式分享
1
+ ## :stars : Go设计模式&数据结构与算法
4
2
5
3
Go语言是一种高效、简洁和可靠的编程语言,它具有强大的类型系统、并发支持和简洁的语法。这些特性使得Go语言成为实现设计模式的理想选择。本仓库将探讨Go语言如何支持设计模式,并分析一些使用Go语言实现的设计模式示例。
6
4
7
- ### 目录
5
+ ### : airplane : 设计模式篇
8
6
9
7
#### DONE
10
8
@@ -41,3 +39,27 @@ Go语言是一种高效、简洁和可靠的编程语言,它具有强大的类
41
39
- 模板方法模式和策略模式
42
40
43
41
- 工厂模式和工厂方法模式
42
+
43
+ - [ Optional模式和Builder模式] ( https://mp.weixin.qq.com/s/dGqaYg1TRhII6jytsfF1Vg )
44
+
45
+ ---
46
+
47
+ ### :speedboat : 数据结构与算法篇
48
+
49
+ B站视频学习:
50
+
51
+ https://www.bilibili.com/video/BV1Fv4y1f7T1
52
+
53
+ 学习进度:
54
+
55
+ - [x] 2 / 42
56
+
57
+ 笔记代码:
58
+
59
+ TODO
60
+
61
+ ---
62
+
63
+ ### 相关博客
64
+
65
+ - [ 这些Coding套路你不会还不知道吧?] ( https://cloud.tencent.com/developer/article/2329818 )
Original file line number Diff line number Diff line change 54
54
import " sync"
55
55
56
56
type MysqlConn struct {
57
- Addr string
57
+ Addr string
58
58
}
59
59
60
60
var (
61
- mysqlConn *MysqlConn
62
- once = sync.Once {}
61
+ mysqlConn *MysqlConn
62
+ once = sync.Once {}
63
63
)
64
64
65
65
func GetMySQLConn () *MysqlConn {
66
- once.Do (func () {
67
- mysqlConn = &MysqlConn{Addr: " 127.0.0.1" }
68
- })
69
- return mysqlConn
66
+ once.Do (func () {
67
+ mysqlConn = &MysqlConn{Addr: " 127.0.0.1" }
68
+ })
69
+ return mysqlConn
70
70
}
71
71
```
72
72
@@ -119,12 +119,12 @@ import (
119
119
)
120
120
121
121
type MakeYogurtTemplate interface {
122
- CreateYogurt () // 准备好酸奶
123
- CutFruit () // 切水果
124
- Merge () // 放在一起搅拌
125
- Optimize () // 调制味道
126
- Eating () // 开吃
127
- Do ()
122
+ CreateYogurt () // 准备好酸奶
123
+ CutFruit () // 切水果
124
+ Merge () // 放在一起搅拌
125
+ Optimize () // 调制味道
126
+ Eating () // 开吃
127
+ Do ()
128
128
}
129
129
130
130
type DragonFruit struct {
You can’t perform that action at this time.
0 commit comments