config_viper

package
v0.0.0-...-8122643 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MergeDirect string = "direct"
	MergeValue  string = "value"
	MergeArray  string = "array"
)

Variables

This section is empty.

Functions

func MakeIncludePath

func MakeIncludePath(configFile string, path string) (string, error)

func MergeConfigFile

func MergeConfigFile(v *viper.Viper, path string, configType ...string) error

func MergeConfigs

func MergeConfigs(fromCfg *ConfigViper, toCfg *ConfigViper, mode string, keysMap map[string]string) error

func ReadConfigFromFile

func ReadConfigFromFile(v *viper.Viper, path string, cfgType string) error

func ReadJsonc

func ReadJsonc(path string) ([]byte, error)

Types

type ConfigViper

type ConfigViper struct {
	*viper.Viper
	// contains filtered or unexported fields
}

func New

func New() *ConfigViper

func (*ConfigViper) ConfigFile

func (c *ConfigViper) ConfigFile() string

func (*ConfigViper) ConfigType

func (c *ConfigViper) ConfigType() string

func (*ConfigViper) GetFloat64Slice

func (c *ConfigViper) GetFloat64Slice(key string) []float64

func (*ConfigViper) Load

func (c *ConfigViper) Load(fromCfg *ConfigViper) error

func (*ConfigViper) LoadFile

func (c *ConfigViper) LoadFile(configFile string, configType ...string) error

func (*ConfigViper) LoadString

func (c *ConfigViper) LoadString(configStr string, configType ...string) error

func (*ConfigViper) Rebuild

func (c *ConfigViper) Rebuild() error

func (*ConfigViper) ToString

func (c *ConfigViper) ToString() string

type ExtendMerge

type ExtendMerge struct {
	Path  string         `json:"path"`
	Rules []IncludeMerge `json:"rules"`
}

type IncludeMerge

type IncludeMerge struct {
	Path string            `json:"path"`
	Mode string            `json:"mode"`
	Map  map[string]string `json:"map"`
}

Jump to

Keyboard shortcuts

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