Documentation ¶
Index ¶
- Constants
- Variables
- func ChDir() error
- func GetApplicationName() string
- func GetFileMd5(fileName string) string
- func Quit()
- func SetDefaultOutLogPath(defaultPath string)
- func Start(serviceName string, cfgType string, instance ServiceInstance)
- type ClosureInstance
- type Config
- type ConfigImpl
- type Pprof
- type PprofConfig
- type ServiceInstance
- type WaterConfig
- type WaterConfigProxy
Constants ¶
View Source
const ( ConfigTypeToml = "toml" ConfigTypeJson = "json" ConfigTypeYaml = "yaml" )
Variables ¶
View Source
var ( ServiceName string ApplicationName string ServiceApp ServiceInstance ConfigPath string ServiceMode bool OutLogPath = "../logs" )
View Source
var ( // Version is app or service version Version = "v0.0.1" GoVersion = runtime.Version() BuildTime = time.Now().Format("2006-01-02 15:04:05.000") CommitHash = "localhost" )
Functions ¶
func GetApplicationName ¶
func GetApplicationName() string
func GetFileMd5 ¶
func SetDefaultOutLogPath ¶
func SetDefaultOutLogPath(defaultPath string)
func Start ¶
func Start(serviceName string, cfgType string, instance ServiceInstance)
Types ¶
type ClosureInstance ¶
type ClosureInstance interface {
Closure()
}
type ConfigImpl ¶
type ConfigImpl struct {
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(configPath, configName, configType string, water WaterConfig) (*ConfigImpl, error)
func NewConfig2 ¶
func NewConfig2(configFile, configType string, water WaterConfig) (*ConfigImpl, error)
func (*ConfigImpl) ReadConfig ¶
func (c *ConfigImpl) ReadConfig() error
func (*ConfigImpl) SetConfig ¶
func (c *ConfigImpl) SetConfig(in string)
func (*ConfigImpl) Sub ¶
func (c *ConfigImpl) Sub(key string) Config
func (*ConfigImpl) Unmarshal ¶
func (c *ConfigImpl) Unmarshal(rawVal interface{}) error
func (*ConfigImpl) UnmarshalKey ¶
func (c *ConfigImpl) UnmarshalKey(key string, rawVal interface{}) error
func (*ConfigImpl) Water ¶
func (c *ConfigImpl) Water()
type Pprof ¶
type Pprof struct {
// contains filtered or unexported fields
}
func NewPprof ¶
func NewPprof(cfg *PprofConfig) *Pprof
func (*Pprof) SetConfig ¶
func (p *Pprof) SetConfig(cfg *PprofConfig)
type PprofConfig ¶
type PprofConfig struct { Trace bool `json:"trace,omitempty" yaml:"trace,omitempty" toml:"trace,omitempty"` Address string `json:"address,omitempty" yaml:"address,omitempty" toml:"address,omitempty"` }
func NewPprofConfig ¶
func NewPprofConfig() *PprofConfig
type ServiceInstance ¶
type WaterConfig ¶
type WaterConfig interface {
OnConfigChange(cfg Config)
}
type WaterConfigProxy ¶
type WaterConfigProxy struct {
// contains filtered or unexported fields
}
func (*WaterConfigProxy) OnConfigChange ¶
func (w *WaterConfigProxy) OnConfigChange(cfg Config)
Click to show internal directories.
Click to hide internal directories.