structure

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action()

func Main

func Main()

Types

type AModuleAPI

type AModuleAPI interface {
	TestA() string
}

AModuleAPI ...

func NewAModuleAPI

func NewAModuleAPI() AModuleAPI

NewAModuleAPI return new AModuleAPI

type API

type API interface {
	Test() string
}

API is facade interface of facade package

func NewAPI

func NewAPI() API

type AddDecorator

type AddDecorator struct {
	Component
	// contains filtered or unexported fields
}

func (*AddDecorator) Calc

func (d *AddDecorator) Calc() int

type BModuleAPI

type BModuleAPI interface {
	TestB() string
}

BModuleAPI ...

func NewBModuleAPI

func NewBModuleAPI() BModuleAPI

NewBModuleAPI return new BModuleAPI

type BridgeComputer

type BridgeComputer interface {
	Print()
	SetPrinter(Printer)
}

还有另外一种理解方式:“一个类存在两个(或多个)独立变化的维度,我们通过组合的方式,让这两个(或多个)维度可以独立进行扩展。 ”通过组合关系来替代继承关系,避免继承层次的指数级爆炸

type Client

type Client struct {
}

适配器模式用于转换一种接口适配另一种接口。

func (*Client) InsertLightningConnectorIntoComputer

func (c *Client) InsertLightningConnectorIntoComputer(com Computer)

type Component

type Component interface {
	Calc() int
}

Component

装饰模式使用对象组合的方式动态改变或增加对象行为。

func WrapAddDecorator

func WrapAddDecorator(c Component, num int) Component

func WrapMulDecorator

func WrapMulDecorator(c Component, num int) Component

type Computer

type Computer interface {
	InsertIntoLightningPort()
}

type ConcreteComponent

type ConcreteComponent struct{}

ConcreteComponent 原始组件

func (*ConcreteComponent) Calc

func (*ConcreteComponent) Calc() int

type Epson

type Epson struct {
}

func (*Epson) PrintFile

func (p *Epson) PrintFile()

type Hp

type Hp struct {
}

func (*Hp) PrintFile

func (p *Hp) PrintFile()

type ImageFlyweight

type ImageFlyweight struct {
	// contains filtered or unexported fields
}

func NewImageFlyweight

func NewImageFlyweight(filename string) *ImageFlyweight

func (*ImageFlyweight) Data

func (i *ImageFlyweight) Data() string

type ImageFlyweightFactory

type ImageFlyweightFactory struct {
	// contains filtered or unexported fields
}

func GetImageFlyweightFactory

func GetImageFlyweightFactory() *ImageFlyweightFactory

func (*ImageFlyweightFactory) Get

func (f *ImageFlyweightFactory) Get(filename string) *ImageFlyweight

type Mac

type Mac struct {
	// contains filtered or unexported fields
}

func (*Mac) Print

func (m *Mac) Print()

func (*Mac) SetPrinter

func (m *Mac) SetPrinter(p Printer)

type MulDecorator

type MulDecorator struct {
	Component
	// contains filtered or unexported fields
}

func (*MulDecorator) Calc

func (d *MulDecorator) Calc() int

type Printer

type Printer interface {
	PrintFile()
}

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

func (Proxy) Do

func (p Proxy) Do() string

type RealSubject

type RealSubject struct{}

func (RealSubject) Do

func (RealSubject) Do() string

type Subject

type Subject interface {
	Do() string
}

type Windows

type Windows struct{}

type WindowsAdapter

type WindowsAdapter struct {
	// contains filtered or unexported fields
}

func (*WindowsAdapter) InsertIntoLightningPort

func (w *WindowsAdapter) InsertIntoLightningPort()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL