From 7a0e67f0b373210e5700829dbc6d6012bff9e6e2 Mon Sep 17 00:00:00 2001 From: Edward Date: Sat, 2 May 2020 18:25:12 +0800 Subject: [PATCH] order patterns in go more catalogs --- README.md | 13 +++++++++---- gomore/{27_messages => 01_messages}/README.md | 0 gomore/{27_messages => 01_messages}/message.go | 0 .../{27_messages => 01_messages}/message_queue.go | 0 gomore/{27_messages => 01_messages}/message_test.go | 0 gomore/{28_profiles => 02_profiles}/README.md | 0 .../time_profile_test.go | 0 gomore/{29_context => 03_context}/README.md | 0 gomore/{29_context => 03_context}/context_test.go | 0 gomore/06_circuit_breaker/README.md | 3 +++ .../circuit_breaker_test.go | 0 .../rate_limiting.go | 0 .../rate_limiting_test.go | 0 gomore/{semaphore => 08_semaphore}/semaphore.go | 0 structure/06_decorator/README.md | 4 ++-- 15 files changed, 14 insertions(+), 6 deletions(-) rename gomore/{27_messages => 01_messages}/README.md (100%) rename gomore/{27_messages => 01_messages}/message.go (100%) rename gomore/{27_messages => 01_messages}/message_queue.go (100%) rename gomore/{27_messages => 01_messages}/message_test.go (100%) rename gomore/{28_profiles => 02_profiles}/README.md (100%) rename gomore/{28_profiles => 02_profiles}/time_profile_test.go (100%) rename gomore/{29_context => 03_context}/README.md (100%) rename gomore/{29_context => 03_context}/context_test.go (100%) create mode 100644 gomore/06_circuit_breaker/README.md rename gomore/{circuit_breaker => 06_circuit_breaker}/circuit_breaker_test.go (100%) rename gomore/{rate_limiting => 07_rate_limiting}/rate_limiting.go (100%) rename gomore/{rate_limiting => 07_rate_limiting}/rate_limiting_test.go (100%) rename gomore/{semaphore => 08_semaphore}/semaphore.go (100%) diff --git a/README.md b/README.md index d1d2909..ccbe50d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Go常用的、面向工程化和最佳实践的模式套路,包含常见的23 + [x] [桥模式(Bridge)](./structure/03_bridge) + [x] [复合模式(Composite)](./structure/05_composite) + [x] [享元模式(Flyweight)](./structure/04_flyweight) -+ [ ] [装饰模式(Decorator)](./structure/06_decorator) ++ [x] [装饰器模式(Decorator)](./structure/06_decorator) + [x] [代理模式(Proxy)](./structure/07_proxy) ## 行为型模式 @@ -52,9 +52,14 @@ Go常用的、面向工程化和最佳实践的模式套路,包含常见的23 ## Go More -+ [x] [发布订阅模式(Pub-Sub)](./gomore/27_messages) -+ [x] [时差模式(Time Profile)](./gomore/28_profiles) -+ [x] [上下文模式(Context)](./gomore/29_context) ++ [x] [发布订阅模式(Pub-Sub)](./gomore/01_messages) ++ [x] [时差模式(Time Profile)](./gomore/02_profiles) ++ [x] [上下文模式(Context)](./gomore/03_context) ++ [ ] [淡入模式(Fan-In)](./gomore/04_fan_in) ++ [ ] [淡出模式(Fan-Out)](./gomore/05_fan_out) ++ [ ] [熔断模式(circuit breaker)](./gomore/06_circuit_breaker) ++ [ ] [限流模式(rate limiting))](./gomore/07_rate_limiting) ++ [ ] [信号量模式(Context)](./gomore/08_semaphore) ## 参考资料(Design patters Articles) diff --git a/gomore/27_messages/README.md b/gomore/01_messages/README.md similarity index 100% rename from gomore/27_messages/README.md rename to gomore/01_messages/README.md diff --git a/gomore/27_messages/message.go b/gomore/01_messages/message.go similarity index 100% rename from gomore/27_messages/message.go rename to gomore/01_messages/message.go diff --git a/gomore/27_messages/message_queue.go b/gomore/01_messages/message_queue.go similarity index 100% rename from gomore/27_messages/message_queue.go rename to gomore/01_messages/message_queue.go diff --git a/gomore/27_messages/message_test.go b/gomore/01_messages/message_test.go similarity index 100% rename from gomore/27_messages/message_test.go rename to gomore/01_messages/message_test.go diff --git a/gomore/28_profiles/README.md b/gomore/02_profiles/README.md similarity index 100% rename from gomore/28_profiles/README.md rename to gomore/02_profiles/README.md diff --git a/gomore/28_profiles/time_profile_test.go b/gomore/02_profiles/time_profile_test.go similarity index 100% rename from gomore/28_profiles/time_profile_test.go rename to gomore/02_profiles/time_profile_test.go diff --git a/gomore/29_context/README.md b/gomore/03_context/README.md similarity index 100% rename from gomore/29_context/README.md rename to gomore/03_context/README.md diff --git a/gomore/29_context/context_test.go b/gomore/03_context/context_test.go similarity index 100% rename from gomore/29_context/context_test.go rename to gomore/03_context/context_test.go diff --git a/gomore/06_circuit_breaker/README.md b/gomore/06_circuit_breaker/README.md new file mode 100644 index 0000000..6a52535 --- /dev/null +++ b/gomore/06_circuit_breaker/README.md @@ -0,0 +1,3 @@ +# 熔断模式 + +也叫断路器模式 diff --git a/gomore/circuit_breaker/circuit_breaker_test.go b/gomore/06_circuit_breaker/circuit_breaker_test.go similarity index 100% rename from gomore/circuit_breaker/circuit_breaker_test.go rename to gomore/06_circuit_breaker/circuit_breaker_test.go diff --git a/gomore/rate_limiting/rate_limiting.go b/gomore/07_rate_limiting/rate_limiting.go similarity index 100% rename from gomore/rate_limiting/rate_limiting.go rename to gomore/07_rate_limiting/rate_limiting.go diff --git a/gomore/rate_limiting/rate_limiting_test.go b/gomore/07_rate_limiting/rate_limiting_test.go similarity index 100% rename from gomore/rate_limiting/rate_limiting_test.go rename to gomore/07_rate_limiting/rate_limiting_test.go diff --git a/gomore/semaphore/semaphore.go b/gomore/08_semaphore/semaphore.go similarity index 100% rename from gomore/semaphore/semaphore.go rename to gomore/08_semaphore/semaphore.go diff --git a/structure/06_decorator/README.md b/structure/06_decorator/README.md index bb2f9f7..17c3b41 100644 --- a/structure/06_decorator/README.md +++ b/structure/06_decorator/README.md @@ -1,6 +1,6 @@ -# 装饰模式 +# 装饰器模式 -装饰模式就是比较简单了,其目的是在不改变原有类型对象的情况下,对其进行装饰,扩展,以达到公共强化和扩展的目的。 +装饰器模式就是比较简单了,就是做装饰,其目的是在不改变原有类型对象的情况下,对其进行装饰,扩展,以达到公共强化和扩展的目的。 装饰模式的目的是在原有功能或者能力的基础上提供额外的更多的能力和特性,这一点和代理模式、复合模式是有很大不同的,了解每一种模式,重点是要了解这个模式的最初的设计者应用场景和其解决目的,以便加以利用。