adaptor

package
v0.0.0-...-bd8c593 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 2 Imported by: 0

README

什么是适配器模式

适配器模式提供与原始类不同的接口,是一种设计上的补偿策略,用来补救设计上的缺陷。如果在设计之初就能规避接口不兼容的问题,就不需要用到适配器模式类。

应用场景

  1. 封装有缺陷的接口设计
  2. 统一多个类的接口设计
  3. 替换依赖的外部系统
  4. 兼容老版本接口
  5. 适配不同格式的数据

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NewLogger

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

func (*NewLogger) Info

func (logger *NewLogger) Info(msg ...string) string

type NewLoggerInterface

type NewLoggerInterface interface {
	Info(msg ...string) string
}

type OldLogger

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

func (*OldLogger) Info

func (logger *OldLogger) Info(msg string) string

Jump to

Keyboard shortcuts

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