configutil

package
v0.11.3-genericstreaming Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package configutil .

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	Get(key string) (val interface{}, ok bool)
}

Config provides access to configurations.

func NewDummyConfig

func NewDummyConfig() Config

NewDummyConfig creates a dummy config.

type Container

type Container interface {
	Config
	AddPriorSource(src Config) error
}

Container manages multiple config sources with priorities.

func NewConfigContainer

func NewConfigContainer() Container

NewConfigContainer creates an empty Container.

type DefaultConfig

type DefaultConfig interface {
	Get(key string, def interface{}) interface{}
}

DefaultConfig provides access to configurations.

func NewDefaultConfig

func NewDefaultConfig(c Config) DefaultConfig

NewDefaultConfig creates a DefaultConfig with the given Config.

type OptionOnce

type OptionOnce struct {
	OptMap map[string]struct{}
}

OptionOnce is used to ensure an option is only set once.

func NewOptionOnce

func NewOptionOnce() *OptionOnce

NewOptionOnce creates a new option once instance.

func (*OptionOnce) OnceOrPanic

func (o *OptionOnce) OnceOrPanic()

OnceOrPanic panics if the Option has already been set.

type RichTypeConfig

type RichTypeConfig interface {
	GetBool(key string) (val, ok bool)
	GetInt(key string) (val int, ok bool)
	GetString(key string) (val string, ok bool)
	GetInt64(key string) (val int64, ok bool)
	GetFloat(key string) (val float64, ok bool)
	GetDuration(key string) (val time.Duration, ok bool)
}

RichTypeConfig provides typed get functions.

func NewRichTypeConfig

func NewRichTypeConfig(c Config) RichTypeConfig

NewRichTypeConfig creates a RichTypeConfig with the given Config.

type RichTypeDefaultConfig

type RichTypeDefaultConfig interface {
	GetBool(key string, def bool) bool
	GetInt(key string, def int) int
	GetString(key, def string) string
	GetInt64(key string, def int64) int64
	GetFloat(key string, def float64) float64
	GetDuration(key string, def time.Duration) time.Duration
}

RichTypeDefaultConfig provides typed get functions with default value support.

func NewRichTypeDefaultConfig

func NewRichTypeDefaultConfig(rtc RichTypeConfig) RichTypeDefaultConfig

NewRichTypeDefaultConfig creates a RichTypeDefaultConfig with the given RichTypeConfig.

Jump to

Keyboard shortcuts

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