setting

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(s *Setting)

Option option func for Setting.

func WithWatchFile

func WithWatchFile(b bool) Option

WithWatchFile 是否监听文件变化

type Setting

type Setting struct {
	// contains filtered or unexported fields
}

Setting setting struct

func NewSetting

func NewSetting(dir string, filename string, opts ...Option) (*Setting, error)

NewSetting create a setting entry. 默认filename文件类型是yaml文件,其他类型ini,json,yml等格式也支持

func (*Setting) GetSections

func (s *Setting) GetSections() map[string]interface{}

GetSections return sections.

func (*Setting) GetVp

func (s *Setting) GetVp() *viper.Viper

GetVp 返回viper.Viper指针对象

func (*Setting) IsSet

func (s *Setting) IsSet(key string) bool

IsSet check key is set.

func (*Setting) ReadSection

func (s *Setting) ReadSection(k string, v interface{}) error

ReadSection read section config.

func (*Setting) ReloadAllSection

func (s *Setting) ReloadAllSection() error

ReloadAllSection if config has changed reload all config.

func (*Setting) WatchSettingChange

func (s *Setting) WatchSettingChange()

WatchSettingChange watch file change.

Jump to

Keyboard shortcuts

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