properties

package
v1.31.9 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Global = &Properties{
	m: make(map[string]string),
}
View Source
var LoadFile = func(filename string) error {
	return Global.LoadFile(filename)
}

Functions

func BindFlags added in v1.29.0

func BindFlags(flags *pflag.FlagSet)

func Duration added in v1.28.0

func Duration(def time.Duration, keys ...string) time.Duration

func Get

func Get(key string) string

func Int

func Int(def int, key string) int

func On

func On(def bool, keys ...string) bool

func RegisterListener

func RegisterListener(fn func(*Properties))

func Set

func Set(key string, value any)

func String

func String(def string, keys ...string) string

func Update

func Update(props map[string]string)

Types

type Properties

type Properties struct {
	Reload func()
	// contains filtered or unexported fields
}

func (*Properties) Duration added in v1.28.0

func (p *Properties) Duration(def time.Duration, keys ...string) time.Duration

func (*Properties) Get

func (p *Properties) Get(key string) string

func (*Properties) GetAll

func (p *Properties) GetAll() map[string]string

func (*Properties) Int

func (p *Properties) Int(def int, key string) int

func (*Properties) LoadFile

func (p *Properties) LoadFile(filename string) error

func (*Properties) On

func (p *Properties) On(def bool, keys ...string) bool

func (*Properties) RegisterListener

func (p *Properties) RegisterListener(fn func(*Properties))

func (*Properties) Set

func (p *Properties) Set(key string, value any)

func (*Properties) String

func (p *Properties) String(def string, keys ...string) string

func (*Properties) Update

func (p *Properties) Update(props map[string]string)

func (*Properties) Watch added in v1.27.0

func (p *Properties) Watch() func()

Jump to

Keyboard shortcuts

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