app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

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 ChDir

func ChDir() error

func GetApplicationName

func GetApplicationName() string

func GetFileMd5

func GetFileMd5(fileName string) string

func Quit

func Quit()

func SetDefaultOutLogPath

func SetDefaultOutLogPath(defaultPath string)

func Start

func Start(serviceName string, cfgType string, instance ServiceInstance)

Types

type ClosureInstance

type ClosureInstance interface {
	Closure()
}

type Config

type Config interface {
	Sub(key string) Config
	Unmarshal(rawVal interface{}) error
	UnmarshalKey(key string, rawVal interface{}) error
}

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) Restart

func (p *Pprof) Restart()

func (*Pprof) SetConfig

func (p *Pprof) SetConfig(cfg *PprofConfig)

func (*Pprof) Start

func (p *Pprof) Start()

func (*Pprof) Stop

func (p *Pprof) Stop()

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 ServiceInstance interface {
	ParseCommandArgs()
	Initialize(Config) error
	ReloadConfig(Config) error
	RunLoop() error
	Destroy()
}

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)

Jump to

Keyboard shortcuts

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