Documentation ¶
Index ¶
- Variables
- func CallBrowser(uri string) error
- func CurrentAndAbsPath() string
- func GetAbsPath(current string) string
- func GetConfigDir() string
- func GetCurrentDir() string
- func GetCurrentFilename() string
- func GetDirPath(dirname string) string
- func GetFilepath(dirname string, filename string) string
- func GetLastPath(currentPath string) string
- func GetOS() string
- func GetRootPath() string
- func ParseEnvVar(varString string) string
- func SetCurrentPath() string
- type CommandServices
- type DaemonServices
- func (d *DaemonServices) GetPidPath() string
- func (d *DaemonServices) GetProgramPath() string
- func (d *DaemonServices) New(execDir, execName, pidDir, pidName string) *DaemonServices
- func (d *DaemonServices) Restart() bool
- func (d *DaemonServices) Start() bool
- func (d *DaemonServices) Stop() bool
- func (d *DaemonServices) Usage()
- type HardwareInfo
- func (info *HardwareInfo) CountGoUseRam() int64
- func (info *HardwareInfo) CountGoroutine() int
- func (info *HardwareInfo) CpuInfo() []cpu.InfoStat
- func (info *HardwareInfo) CpuLoad() *load.AvgStat
- func (info *HardwareInfo) DiskFreeSpace() (diskFree uint64)
- func (info *HardwareInfo) DiskState() (diskFree uint64, diskUsed float64)
- func (info *HardwareInfo) GetCpuPercent() (cpuInfo float64)
- func (info *HardwareInfo) GetDiskUsedPercent() (diskUsed float64)
- func (info *HardwareInfo) GetHardwareState()
- func (info *HardwareInfo) IsDiskFull(dir string) bool
- func (info *HardwareInfo) RamUsed() (used float64)
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = new(CommandServices)
View Source
var Cron *cron.Cron
View Source
var Daemon = new(DaemonServices)
View Source
var Env = new(env)
View Source
var Hardware = new(HardwareInfo)
View Source
var IpAddr = new(ipAddr)
View Source
var Quartz = new(quartz)
View Source
var Terminal = new(terminal)
View Source
var Version = "0.0.1"
Version Set by release.
Functions ¶
func GetFilepath ¶
Get absolute path by directory name and file name.
func ParseEnvVar ¶
环境变量解析: 根据环境变量的值替换字符串中的 ${var} or $var, 如果不存在任何环境变量, 则使用空字符串替换
Types ¶
type CommandServices ¶
func (*CommandServices) Run ¶
func (cs *CommandServices) Run(execDir, execName, pidDir, pidName string)
type DaemonServices ¶
type DaemonServices struct { ExecDir string ExecName string PidDir string PidName string // contains filtered or unexported fields }
func (*DaemonServices) GetPidPath ¶
func (d *DaemonServices) GetPidPath() string
func (*DaemonServices) GetProgramPath ¶
func (d *DaemonServices) GetProgramPath() string
func (*DaemonServices) New ¶
func (d *DaemonServices) New(execDir, execName, pidDir, pidName string) *DaemonServices
func (*DaemonServices) Restart ¶
func (d *DaemonServices) Restart() bool
func (*DaemonServices) Start ¶
func (d *DaemonServices) Start() bool
func (*DaemonServices) Stop ¶
func (d *DaemonServices) Stop() bool
func (*DaemonServices) Usage ¶
func (d *DaemonServices) Usage()
type HardwareInfo ¶
type HardwareInfo struct { CPU float64 `json:"cpu"` DiskFree uint64 `json:"diskFree"` DiskUsedPercent float64 `json:"diskUsedPercent"` MemUsedPercent float64 `json:"memUsedPercent"` GoMemory int64 `json:"goMemory"` GoRoutines int `json:"goRoutines"` DirPath string }
func (*HardwareInfo) CountGoUseRam ¶
func (info *HardwareInfo) CountGoUseRam() int64
计算Golang运行时分配的内存总字节数
func (*HardwareInfo) CountGoroutine ¶
func (info *HardwareInfo) CountGoroutine() int
计算当前Goroutine的数量
func (*HardwareInfo) DiskFreeSpace ¶
func (info *HardwareInfo) DiskFreeSpace() (diskFree uint64)
获取硬盘已使用空间
func (*HardwareInfo) DiskState ¶
func (info *HardwareInfo) DiskState() (diskFree uint64, diskUsed float64)
获取硬盘状态
func (*HardwareInfo) GetCpuPercent ¶
func (info *HardwareInfo) GetCpuPercent() (cpuInfo float64)
func (*HardwareInfo) GetDiskUsedPercent ¶
func (info *HardwareInfo) GetDiskUsedPercent() (diskUsed float64)
获取硬盘使用百分比
Click to show internal directories.
Click to hide internal directories.