bridge

package
v0.0.0-...-eb36113 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0, MIT Imports: 1 Imported by: 0

README

桥接模式

桥接模式分离抽象部分和实现部分。使得两部分独立扩展。

桥接模式类似于策略模式,区别在于策略模式封装一系列算法使得算法可以互相替换。

策略模式使抽象部分和实现部分分离,可以独立变化。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractMessage

type AbstractMessage interface {
	SendMessage(text, to string)
}

type CommonMessage

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

func NewCommonMessage

func NewCommonMessage(method MessageImplementer) *CommonMessage

func (*CommonMessage) SendMessage

func (m *CommonMessage) SendMessage(text, to string)

type MessageEmail

type MessageEmail struct{}

func (*MessageEmail) Send

func (*MessageEmail) Send(text, to string)

type MessageImplementer

type MessageImplementer interface {
	Send(text, to string)
}

func ViaEmail

func ViaEmail() MessageImplementer

func ViaSMS

func ViaSMS() MessageImplementer

type MessageSMS

type MessageSMS struct{}

func (*MessageSMS) Send

func (*MessageSMS) Send(text, to string)

type UrgencyMessage

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

func NewUrgencyMessage

func NewUrgencyMessage(method MessageImplementer) *UrgencyMessage

func (*UrgencyMessage) SendMessage

func (m *UrgencyMessage) SendMessage(text, to string)

Jump to

Keyboard shortcuts

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