once

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Once

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

Once 更强大的Once实现 在调用 f 失败的时候不会设置 done 并且可以返回失败信息 在失败的情况下也可以继续调用 Once 重试

func (*Once) Do

func (o *Once) Do(f func() error) error

Do 传入的函数f有返回值error,如果初始化失败,需要返回失败的error Do方法会把这个error返回给调用者

Jump to

Keyboard shortcuts

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