Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bytexlee/go-patterns
/ types & classes
Types & classes
107 in github.com/bytexlee/go-patterns
⨍
Functions
226
◇
Types & classes
107
Interface
ActionState
因为含有多种状态,状态类型不确定,这里需要声明State接口,多态原则
14-state-pattern/state.go:45
Struct
AddExpression
加法表达式
26-interpreter-pattern/interpreter.go:26
Struct
Addition
Addition struct inherit Operator
08-strategy-pattern/strategy.go:17
Struct
Analysis
18-iterator-pattern/iterator.go:49
Struct
Apple
Apple结构体
21-bridge-pattern/bridge.go:34
Struct
AppleDecorator
装饰结构体
05-decorator-pattern/decorator.go:25
Struct
Boy
定义具体子类,且实现具体的action
20-template-method-pattern/template_method.go:33
Interface
Builder
builder interface
01-builder-patterns/builder.go:13
Struct
Car
car struct
01-builder-patterns/builder.go:34
Struct
Caretaker
*创建管理者Caretaker*/ 实现创建备忘录和恢复发起者状态方法
24-memento-pattern/memento.go:43
Struct
CashPay
实现两个struct,继承接口Payment
02-factory-method-patterns/factory_method.go:17
Struct
Circle
创建circle,实现shape方法
17-flyweight-pattern/flyweight.go:10
Struct
ClosedState
Closed State
14-state-pattern/state.go:81
Interface
Command
*创建Command接口*/
23-command-pattern/command.go:26
Interface
Component
05-decorator-pattern/decorator.go:5
Struct
ConCreteFactory
具体工厂
11-abstract-factory/abstract_factory.go:25
Struct
ConcreteCommandA
创建具体command, 指定接收者
23-command-pattern/command.go:31
Struct
ConcreteCommandB
23-command-pattern/command.go:39
Struct
ConcreteProduct
具体的产品
11-abstract-factory/abstract_factory.go:16
Struct
Container
创建容器
18-iterator-pattern/iterator.go:26
Struct
Context
context对象,根据HealthValue的不同值设置不同状态
14-state-pattern/state.go:6
Struct
Count
count struct
19-facade-pattern/facade.go:22
Struct
Cpu
具体类型CPU和Storage
21-bridge-pattern/bridge.go:11
Struct
CreditPay
02-factory-method-patterns/factory_method.go:21
Struct
Director
Director
01-builder-patterns/builder.go:21
TypeAlias
EagerVisitorList
将多个[]Visitor封装为一个Visitor
15-visitor-pattern/visitor.go:26
Struct
Event
22-chain-of-responsibility-pattern/chain.go:57
Struct
Event
定义事件结构体
07-observer-pattern/observer.go:6
Struct
Example
16-prototype-pattern/prototype.go:3
Interface
Expression
定义接口表达式
26-interpreter-pattern/interpreter.go:9
Struct
Facade
外观结构Facade
19-facade-pattern/facade.go:33
Interface
Factory
11-abstract-factory/abstract_factory.go:7
Struct
Fruit
基础结构体
05-decorator-pattern/decorator.go:11
Struct
GamePlayer
在音乐播放基础上实现游戏播放 定义游戏结构体
12-adapter-pattern/adapter.go:25
Struct
GamePlayerAdapter
这里要实现调用play方法的时候,实现GamePlayer的播放 通过组合的方式,声明一个Game的适配器
12-adapter-pattern/adapter.go:36
Struct
Girl
20-template-method-pattern/template_method.go:42
Struct
HuaWei
HuaWei结构体
21-bridge-pattern/bridge.go:47
Interface
IDepartment
创建IDepartment接口
25-mediator-pattern/mediator.go:27
Interface
IObject
1.use proxy and object they must implement same methods
06-proxy-pattern/proxy.go:6
Struct
Info
15-visitor-pattern/visitor.go:8
Interface
Interface
定义Interface
22-chain-of-responsibility-pattern/chain.go:6
Interface
Interface
09-semaphore-pattern/semaphore.go:13
Struct
InvestorObserver
通过具体对象来实现接口 投资人观察者
07-observer-pattern/observer.go:23
Struct
Invoker
*创建请求对象, 维护请求cmd*/
23-command-pattern/command.go:48
Struct
Iterator
创建迭代器
18-iterator-pattern/iterator.go:6
TypeAlias
Kind
02-factory-method-patterns/factory_method.go:5
Struct
Market
创建具体 Market Department
25-mediator-pattern/mediator.go:46
Struct
Mediator
创建Mediator
25-mediator-pattern/mediator.go:6
Struct
Memento
*创建Memento struct*/ 属性可以为state,或Originator对象
24-memento-pattern/memento.go:29
Struct
Menu
Menu结构体
13-composite-pattern/composite.go:68
Interface
MenuComponent
接下来实现Menu struct, Menu包含共同部分MenuDesc以及列表, 将列表部分分离出来 * MenuGroup, 这里引入接口MenuComponent, 因为child类型是不确定的 此外,由于接口为Menu和MenuItem的共同接口,所以包含Price和Print方法 */
13-composite-pattern/composite.go:48
Struct
MenuDesc
抽离共同属性部分
13-composite-pattern/composite.go:6
Struct
MenuGroup
13-composite-pattern/composite.go:52
Struct
MenuItem
MenuItem组合,继承了MenuDesc的方法
13-composite-pattern/composite.go:19
Struct
Multiplication
Multiplication struct
08-strategy-pattern/strategy.go:24
Struct
Music
music struct
19-facade-pattern/facade.go:4
Struct
MusicPlayer
12-adapter-pattern/adapter.go:10
Struct
NormalState
* 具体的状态,继承接口 */ Normal state
14-state-pattern/state.go:55
Interface
Notifier
07-observer-pattern/observer.go:15
Struct
NumExpression
实现具体的类 整数表达式
26-interpreter-pattern/interpreter.go:16
FuncType
Object
func(int) int
05-decorator-pattern/decorator_wrap_func.go:5
Struct
Object
03-object-pool-pattern/object_pool.go:5
Struct
Object
2.object represents real objects which proxy will delegate data
06-proxy-pattern/proxy.go:11
Struct
ObjectA
定义ObjectA struct
22-chain-of-responsibility-pattern/chain.go:12
Struct
ObjectB
定义ObjectB struct
22-chain-of-responsibility-pattern/chain.go:35
Interface
Observer
设计观察者和被观察者接口
07-observer-pattern/observer.go:11
Struct
Operation
包装器
08-strategy-pattern/strategy.go:8
Interface
Operator
08-strategy-pattern/strategy.go:3
Struct
Originator
* 跟原型模式有些相识 设计思想: 1. 发起人角色 Originator: 记录当前的内部状态, 负责创建和恢复备忘录数据 2. 备忘录角色 Memento : 存储发起人对象的内部状态 3. 管理者角色 Caretaker: 负责保存备忘录对象 *代码上实现逻辑: 通过
24-memento-pattern/memento.go:15
Struct
P
main.go:5
Struct
Parser
定义解析器
26-interpreter-pattern/interpreter.go:46
Interface
Payment
02-factory-method-patterns/factory_method.go:12
Struct
Person
定义父类Person
20-template-method-pattern/template_method.go:13
Struct
Phone
桥接层结构体
21-bridge-pattern/bridge.go:24
Interface
Player
音乐播放器
12-adapter-pattern/adapter.go:6
TypeAlias
Pool
03-object-pool-pattern/object_pool.go:9
Interface
Product
11-abstract-factory/abstract_factory.go:11
Struct
ProxyObject
ProxyObject represent proxy object with intercepts actions
06-proxy-pattern/proxy.go:21
Struct
Publisher
27-publish-and-subscribe/pubsub.go:13
Interface
Receiver
*创建Receiver, 这里使用接口,为了实现多个receiver。(可以创建Receiver struct)*/
23-command-pattern/command.go:6
Struct
ReceiverA
创建具体的接收者,实现接口方法
23-command-pattern/command.go:11
Struct
ReceiverB
23-command-pattern/command.go:18
Struct
RestrictedState
Restricted State
14-state-pattern/state.go:68
Struct
Semaphore
定义结构体, 信号量使用chan struct{}
09-semaphore-pattern/semaphore.go:19
Interface
Shape
创建shape接口
17-flyweight-pattern/flyweight.go:4
Interface
Shape
定义接口
20-template-method-pattern/template_method.go:6
Struct
ShapeFactory
创建ShapeFactory
17-flyweight-pattern/flyweight.go:24
Struct
ShareNotifier
股票被观察者
07-observer-pattern/observer.go:32
Interface
SoftWare
抽象接口
21-bridge-pattern/bridge.go:6
Struct
Storage
21-bridge-pattern/bridge.go:17
Struct
StreamVisitor
15-visitor-pattern/visitor.go:48
Struct
SubExpression
减法表达式
26-interpreter-pattern/interpreter.go:36
TypeAlias
TYPE
使用工厂方法模式来创建ConcreteCommand
23-command-pattern/command.go:69
Struct
Teacher
创建具体的visitor对象
18-iterator-pattern/iterator.go:47
Struct
Technical
创建具体 Technical Department
25-mediator-pattern/mediator.go:33
Struct
URLVisitor
url visit
15-visitor-pattern/visitor.go:66
Struct
Vehicle
定义父struct
01-builder-patterns/builder.go:6
Struct
Video
Video struct
19-facade-pattern/facade.go:13
Interface
Visitor
visitor 接口
15-visitor-pattern/visitor.go:18
Interface
Visitor
创建Visitor接口
18-iterator-pattern/iterator.go:42
next →
1–100 of 107, ranked by callers