config

package module
v0.0.0-...-c6e0919 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: AGPL-3.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

config

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config[M any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func MustNewConfig

func MustNewConfig[M any](key string) *Config[M]

func NewConfig

func NewConfig[M any](key string) (*Config[M], error)

func (*Config[M]) Get

func (p *Config[M]) Get() *M

func (*Config[M]) OnChange

func (p *Config[M]) OnChange(logic func(c *M))

func (*Config[M]) Set

func (p *Config[M]) Set(value *M) error

func (*Config[M]) SetWithLock

func (p *Config[M]) SetWithLock(logic func(value *M) *M) error

func (*Config[M]) Update

func (p *Config[M]) Update()

type PrefixConfig

type PrefixConfig[M any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPrefixConfig

func NewPrefixConfig[M any](prefix string) (*PrefixConfig[M], error)

func (*PrefixConfig[M]) ForEach

func (p *PrefixConfig[M]) ForEach(logic func(key string, value *M) error) error

func (*PrefixConfig[M]) Get

func (p *PrefixConfig[M]) Get(key string) *M

func (*PrefixConfig[M]) Set

func (p *PrefixConfig[M]) Set(key string, value *M) error

func (*PrefixConfig[M]) SetWithLock

func (p *PrefixConfig[M]) SetWithLock(key string, logic func(key string, value *M) *M) error

func (*PrefixConfig[M]) Update

func (p *PrefixConfig[M]) Update(key string) error

Jump to

Keyboard shortcuts

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