global

package
v0.0.0-...-38575d5 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: AGPL-3.0 Imports: 8 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env

func Env() *env.Env

Env returns registered env, should be available globally

func FuncWithTimeout

func FuncWithTimeout(ctx context.Context, f func()) error

func GetInitCallback

func GetInitCallback() []func()

func GetShutdownCallback

func GetShutdownCallback() []func()

func Lookup

func Lookup(k RegisterKey) interface{}

func MustLookup

func MustLookup(k RegisterKey) interface{}

func MustLookupString

func MustLookupString(k RegisterKey) string

func Register

func Register(k RegisterKey, v interface{})

Register is used to register your own key and value

func RegisterBackgroundCallback

func RegisterBackgroundCallback(task *BackgroundTask)

func RegisterEnv

func RegisterEnv(e1 *env.Env)

RegisterEnv is used to register env to this register hub

func RegisterInitCallback

func RegisterInitCallback(callback func())

func RegisterShutdownCallback

func RegisterShutdownCallback(callback func())

func RunBackgroundCallbacks

func RunBackgroundCallbacks()

func ShuttingDown

func ShuttingDown() bool

Types

type BackgroundTask

type BackgroundTask struct {
	Tag  string
	Func func()

	Interval time.Duration
	// contains filtered or unexported fields
}

type RegisterKey

type RegisterKey string

RegisterKey is used to register custom value and retrieve back

Jump to

Keyboard shortcuts

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