creational

package
v0.0.0-...-7e26a5e Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstance

func GetInstance() *singleton

懒汉式,需要加锁,不然的话同时创造多个懒汉式实例会成为饿汉式

Types

type AbstractFactory

type AbstractFactory interface {
	CreateArchitest() Architest
	CreateProgrammer() Programmer
}

type AbstractMethodFactory

type AbstractMethodFactory interface {
	CreateFruit() Fruit_1
}

type Apple

type Apple struct {
	Fruit
}

func (*Apple) Show

func (apple *Apple) Show()

type AppleFactory

type AppleFactory struct {
	AbstractMethodFactory
}

func (*AppleFactory) CreateFruit

func (fac *AppleFactory) CreateFruit() Fruit_1

type Apple_1

type Apple_1 struct {
	Fruit_1
}

func (*Apple_1) Show

func (apple *Apple_1) Show()

type Architest

type Architest interface {
	Design()
}

type Banana

type Banana struct {
	Fruit
}

func (*Banana) Show

func (banana *Banana) Show()

type BananaFactory

type BananaFactory struct {
	AbstractFactory
}

func (*BananaFactory) CreateFruit

func (fac *BananaFactory) CreateFruit() Fruit_1

type Banana_1

type Banana_1 struct {
	Fruit_1
}

func (*Banana_1) Show

func (banana *Banana_1) Show()

type Factory

type Factory struct{}

func (*Factory) CreateFruit

func (factory *Factory) CreateFruit(kind string) Fruit

type FrontArchitest

type FrontArchitest struct{}

func (*FrontArchitest) Design

func (front *FrontArchitest) Design()

type FrontFactory

type FrontFactory struct{}

func (*FrontFactory) CreateArchitest

func (front *FrontFactory) CreateArchitest() Architest

func (*FrontFactory) CreateProgrammer

func (front *FrontFactory) CreateProgrammer() Programmer

type FrontProgrammer

type FrontProgrammer struct{}

func (*FrontProgrammer) Work

func (front *FrontProgrammer) Work()

type Fruit

type Fruit interface {
	Show()
}

type Fruit_1

type Fruit_1 interface {
	Show()
}

type Programmer

type Programmer interface {
	Work()
}

Jump to

Keyboard shortcuts

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