singleton

package
v0.0.0-...-5bddfbe Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: 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 Singleton

type Singleton interface {
	// contains filtered or unexported methods
}

Singleton 是单例模式接口,导出的 通过该接口可以避免 GetInstance 返回一个包私有类型的指针

func GetInstance

func GetInstance() Singleton

GetInstance 用于获取单例模式对象

Jump to

Keyboard shortcuts

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