update
This commit is contained in:
parent
05b12c89f1
commit
1064ec934f
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
6. [备忘录模式](https://github.com/silsuer/golang-design-patterns/tree/master/memento-pattern)
|
6. [备忘录模式](https://github.com/silsuer/golang-design-patterns/tree/master/memento-pattern)
|
||||||
|
|
||||||
7. 中介者模式
|
7. [中介者模式](https://github.com/silsuer/golang-design-patterns/tree/master/mediator-pattern)
|
||||||
|
|
||||||
8. 迭代器模式
|
8. 迭代器模式
|
||||||
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
// 中介者接口
|
|
||||||
type IMediator interface {
|
|
||||||
Notify(c IClient) // 接受通知
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户端接口
|
|
||||||
type IClient interface {
|
|
||||||
Column()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 具体中介者,定义关联关系
|
|
||||||
type Mediator struct {
|
|
||||||
From IClient
|
|
||||||
To IClient
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Mediator) Notify(c IClient) {
|
|
||||||
// 会通知所有
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println(1)
|
|
||||||
}
|
|
Reference in New Issue
Block a user