actualCombat

package
v0.0.0-...-05962f3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observer

type Observer interface {
	Update(string)
	GetID() string
}

定义观察者接口

func RemoveFromslice

func RemoveFromslice(ObserverList []Observer, ObserverToRemove Observer) []Observer

type Product

type Product struct {
	ObserverList []Observer
	// contains filtered or unexported fields
}

商品类

func NewProduct

func NewProduct(name string) *Product

新增商品

func (*Product) Deregister

func (i *Product) Deregister(o Observer)

从观察者列表删除

func (*Product) NotifyAll

func (i *Product) NotifyAll()

通知所有用户

func (*Product) Register

func (i *Product) Register(o Observer)

注册到观察者列表

func (*Product) UpdateAvailability

func (i *Product) UpdateAvailability()

更新库存状态

type Subject

type Subject interface {
	Register(Observer Observer)
	Deregister(Observer Observer)
	NotifyAll()
}

主体类

type User

type User struct {
	Id string
}

定义用户模型

func (*User) GetID

func (c *User) GetID() string

获取编号

func (*User) Update

func (c *User) Update(ProductName string)

更新

Jump to

Keyboard shortcuts

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