example

package
v0.0.0-...-8d22ec3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

上下文

func NewContext

func NewContext() *Context

创建一个新的上下文对象

func (*Context) Execute

func (c *Context) Execute()

上下文的方法

func (*Context) SetStrategy

func (c *Context) SetStrategy(strategy Strategy)

设置上下文执行的策略

type Strategy

type Strategy interface {
	Execute()
}

策略接口

func NewStrategyA

func NewStrategyA() Strategy

创建策略 A 的新对象

func NewStrategyB

func NewStrategyB() Strategy

创建策略 B 的新对象

Jump to

Keyboard shortcuts

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