properties

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidPropertyName

func IsValidPropertyName(propName string) bool

func IsValidPropertySubName

func IsValidPropertySubName(propName string) bool

func NewEnvPropertyBacking

func NewEnvPropertyBacking() *envPropertyBacking

func NewFileSystemPropertyBacking

func NewFileSystemPropertyBacking(root string) *filesystemPropertyBacking

func NewPropertyService

func NewPropertyService(backing ...PropertyBacking) *stdPropertyService

Create a new property service using the provided "backing" providers, in decreasing order of priority. * For example, passing (filesystem, env, map) will give priority to filesystem, then env (for keys that are * missing in the filesystem store) then finally map. * nil values are acceptable and ignored.

func NewStaticMapPropertyBacking

func NewStaticMapPropertyBacking(propertyMap map[string]string) *staticMapPropertyBacking

Types

type PropertyBacking

type PropertyBacking interface {
	GetProperty(name string) (value string, present bool)
	Refresh()
}

type PropertyBackingGetter

type PropertyBackingGetter func(name string) (value string, present bool)

type PropertyService

type PropertyService interface {
	GetString(name string, fallback string) PropertyValue
	GetBool(name string, fallback bool) PropertyValue
	GetUInt64(name string, fallback uint64) PropertyValue
	GetFloat64(name string, fallback float64) PropertyValue
	Refresh()

	GetBoolSub(name string, fallback bool, sub ...interface{}) PropertyValue
	GetUInt64Sub(name string, fallback uint64, sub ...interface{}) PropertyValue
}

type PropertyValue

type PropertyValue interface {
	FromFallback() bool
	Bool() bool
	Uint64() uint64
	String() string
	Float64() float64
}

Jump to

Keyboard shortcuts

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