Help us shape the future of Go! Take the 2026 Go Developer Survey

singleton

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package singleton provides an atomic holder for a process-wide default instance of a service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Value

type Value[T any] struct {
	// contains filtered or unexported fields
}

Value holds a process-wide default instance of T

func (*Value[T]) Get

func (v *Value[T]) Get() *T

Get returns the process-wide default instance, or nil when none is registered

func (*Value[T]) Set

func (v *Value[T]) Set(instance *T)

Set registers the process-wide default instance

Jump to

Keyboard shortcuts

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