Documentation ¶
Index ¶
- type Configer
- type ConfigerInterface
- type Core
- func (this *Core) AddConfigPath(in string)
- func (this *Core) ReadConfig() (*viper.Viper, error)
- func (this *Core) SetAutomaticEnv()
- func (this *Core) SetConfigName(in string)
- func (this *Core) SetConfigType(in string)
- func (this *Core) SetDefault(key string, value interface{}) CoreInterface
- func (this *Core) WriteConfig() error
- func (this *Core) WriteConfigAs(path string) error
- type CoreInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configer ¶
type Configer struct {
// contains filtered or unexported fields
}
Configer : 整體設定檔
func (*Configer) AddCore ¶
func (this *Configer) AddCore(key string, handler CoreInterface) ConfigerInterface
AddCore : 加入組態控制器
func (*Configer) GetCore ¶
func (this *Configer) GetCore(key string) CoreInterface
GetCore : 取得組態控制器
type ConfigerInterface ¶
type ConfigerInterface interface { GetCore(key string) CoreInterface AddCore(key string, handler CoreInterface) ConfigerInterface }
var ( //Config : 設定檔變數 Config ConfigerInterface )
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func (*Core) AddConfigPath ¶
func (*Core) SetAutomaticEnv ¶
func (this *Core) SetAutomaticEnv()
func (*Core) SetConfigName ¶
func (*Core) SetConfigType ¶
func (*Core) SetDefault ¶ added in v1.0.1
func (this *Core) SetDefault(key string, value interface{}) CoreInterface
func (*Core) WriteConfig ¶ added in v1.0.1
func (*Core) WriteConfigAs ¶ added in v1.0.1
type CoreInterface ¶
type CoreInterface interface { SetAutomaticEnv() SetDefault(key string, value interface{}) CoreInterface WriteConfig() error WriteConfigAs(path string) error SetConfigType(in string) SetConfigName(in string) AddConfigPath(in string) ReadConfig() (*viper.Viper, error) }
func NewConfigerCore ¶
func NewConfigerCore(configType string, configName string, paths ...string) CoreInterface
參數依序為: / 1. 設定檔類型 (支援 yaml、yml、json、properties、ini、hcl、toml) / 2. 檔案名稱 (例如檔名為 config.yaml 就輸入 config) / 3. 後續皆為檔案路徑,可以支援多個路徑尋找檔案
Click to show internal directories.
Click to hide internal directories.