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: 0

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