conffile

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(opts ...FileConfigOption) config.Config

Types

type DefaultFileParser

type DefaultFileParser struct {
}

func NewDefaultFileParser

func NewDefaultFileParser() *DefaultFileParser

func (*DefaultFileParser) Read

func (this *DefaultFileParser) Read(filePath string) (map[string]string, error)

func (*DefaultFileParser) Write

func (this *DefaultFileParser) Write(filePath string, m *map[string]string) error

type FileConfig

type FileConfig struct {
	Debug bool
	// contains filtered or unexported fields
}

func (*FileConfig) ApplyConfig

func (this *FileConfig) ApplyConfig(m map[string]string)

interface ConfigObaserver

func (*FileConfig) ApplyDefault

func (this *FileConfig) ApplyDefault()

func (*FileConfig) Destroy

func (this *FileConfig) Destroy()

func (*FileConfig) GetBoolean

func (this *FileConfig) GetBoolean(key string, def bool) bool

func (*FileConfig) GetConfFile

func (this *FileConfig) GetConfFile() string

func (*FileConfig) GetFloat

func (this *FileConfig) GetFloat(key string, def float32) float32

func (*FileConfig) GetInt

func (this *FileConfig) GetInt(key string, def int) int32

func (*FileConfig) GetIntSet

func (this *FileConfig) GetIntSet(key, defaultValue, deli string) []int32

func (*FileConfig) GetKeys

func (this *FileConfig) GetKeys() []string

func (*FileConfig) GetLong

func (this *FileConfig) GetLong(key string, def int64) int64

func (*FileConfig) GetStringArray

func (this *FileConfig) GetStringArray(key, def, deli string) []string

func (*FileConfig) GetStringHashCodeSet

func (this *FileConfig) GetStringHashCodeSet(key, defaultValue, deli string) []int32

func (*FileConfig) GetStringHashSet

func (this *FileConfig) GetStringHashSet(key, defaultValue, deli string) []int32

func (*FileConfig) GetValue

func (this *FileConfig) GetValue(key string) string

func (*FileConfig) GetValueDef

func (this *FileConfig) GetValueDef(key, def string) string

func (*FileConfig) GetWhatapHome

func (this *FileConfig) GetWhatapHome() string

func (*FileConfig) InArray

func (this *FileConfig) InArray(str string, list []string) bool

func (*FileConfig) SetValues

func (this *FileConfig) SetValues(keyValues *map[string]string)

func (*FileConfig) String

func (this *FileConfig) String() string

func (*FileConfig) ToString

func (this *FileConfig) ToString() string

type FileConfigOption

type FileConfigOption interface {
	// contains filtered or unexported methods
}

func WithConfigObserver

func WithConfigObserver(obj *config.ConfigObserver) FileConfigOption

func WithContext

func WithContext(ctx context.Context, cancel context.CancelFunc) FileConfigOption

func WithExcludeKeys

func WithExcludeKeys(keys []string) FileConfigOption

func WithHomePath

func WithHomePath(home string) FileConfigOption

func WithLogger

func WithLogger(logger logger.Logger) FileConfigOption

func WithParser

func WithParser(ps FileParser) FileConfigOption

func WithPrefix

func WithPrefix(prefix string) FileConfigOption

func WithSuffix

func WithSuffix(suffix string) FileConfigOption

type FileParser

type FileParser interface {
	Read(filePath string) (map[string]string, error)
	Write(fielPath string, m *map[string]string) error
}

Jump to

Keyboard shortcuts

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