config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDecoder

func RegisterDecoder(fileType FileType, decoder Decoder)

Types

type Config

type Config interface {
	FileNames() []string
	GetFloat64(key string) float64
	GetFloat64OrDefault(key string, def float64) float64
	GetBool(key string) bool
	GetBoolOrDefault(key string, def bool) bool
	GetString(key string) string
	GetStringOrDefault(key string, def string) string
	GetInt(key string) int
	GetIntOrDefault(key string, def int) int
	GetIntSlice(key string) []int
	GetIntSliceOrDefault(key string, def []int) []int
	GetStringMap(key string) map[string]interface{}
	GetStringMapOrDefault(key string, def map[string]interface{}) map[string]interface{}
	GetStringMapString(key string) map[string]string
	GetStringMapStringOrDefault(key string, def map[string]string) map[string]string
	GetStringSlice(key string) []string
	GetStringSliceOrDefault(key string, def []string) []string
	GetTime(key string) time.Time
	GetTimeOrDefault(key string, def time.Time) time.Time
	GetDuration(key string) time.Duration
	GetDurationOrDefault(key string, def time.Duration) time.Duration
	Get(key string) interface{}
}

func New

func New(pathType PathType, ignoreFileNameKey bool, paths ...string) (Config, error)

type Decoder

type Decoder interface {
	Decode([]byte, map[string]interface{}) error
}

type FileType

type FileType uint8
const (
	UnknownFileType FileType = iota
	YamlFileType
	TomlFileType
	IniFileType
	JsonFileType
)

type PathType added in v0.4.0

type PathType int8
const (
	PathTypeFile PathType = 1
	PathTypePath PathType = 2
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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