Documentation ¶
Overview ¶
Package base provide some base functions of GoLang
Index ¶
- func Daemon()
- func GetAppName() string
- func GetAssetsPath(p ...string) string
- func GetBuildDir() string
- func GetBuildGo() string
- func GetBuildHash() string
- func GetBuildTime() string
- func GetExecDir() string
- func GetExecName() string
- func GetIP() net.IP
- func GetPath(p ...string) string
- func GetReloadTime() time.Time
- func GetStartTime() time.Time
- func GetVersion() string
- func GetWorkDir() string
- func IsLiteMode() bool
- func LiverCancel(key string)
- func LiverRegister(key string, timeout time.Duration)
- func Reload()
- func ReloadCancel(key string)
- func ReloadRegister(function func() error, key string)
- func Retire(code int, args ...bool)
- func RetireCancel(key string)
- func RetireRegister(function func() error, key string)
- func SetLiteMode(mode bool)
- func Usr2Register(usr2 func())
- type Task
- type TaskBase
- type TaskType
- type Tasker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Daemon ¶
func Daemon()
Daemon will retire current process and pretend to start a daemon process
func GetAssetsPath ¶
GetAssetsPath return the absolute path of assets
func GetBuildHash ¶
func GetBuildHash() string
GetBuildHash return Git HEAD hash of source code at building
func LiverRegister ¶
LiverRegister is used to register a liver hunter
func ReloadCancel ¶
func ReloadCancel(key string)
ReloadCancel is used to cancel a function to be executed when reload
func ReloadRegister ¶
ReloadRegister is used to register a function to be executed when reload
func RetireCancel ¶
func RetireCancel(key string)
RetireCancel is used to cancel a function to be executed when retire
func RetireRegister ¶
RetireRegister is used to register a function to be executed when retire
func Usr2Register ¶ added in v0.0.9
func Usr2Register(usr2 func())
Usr2Register register a callback function that execute after SIGUSR2 received
Types ¶
type Task ¶
type Task struct { Tasker // contains filtered or unexported fields }
Task context
func NewTasking ¶ added in v0.0.5
NewTasking return a task from tasker interface and start immediately
type TaskBase ¶
type TaskBase struct { Name string Type TaskType Log *logrus.Entry // Trigger's type is according to task type // TaskTypeManual: nil // TaskTypeOnAccept: net.Listener // TaskTypeOnChannel: Channel // TaskTypeOnInterval: time.Duration Trigger interface{} // Argument's value is according to task type // TaskTypeManual: enable auto reload if value is true // TaskTypeOnAccept: net.Conn that accept from net.Listener // TaskTypeOnChannel: value that received from channel // TaskTypeOnInterval: disable liver hunter if value is true Argument interface{} // Level is used to control log level of complex log Level logrus.Level // Log less if Lite is true // TaskOnInterval will sleep if Sleep flag is true // Task will schedule immediately after start if Immediately flag is true Lite, Sleep, Immediately bool // contains filtered or unexported fields }
TaskBase is used for options of Task It must be wrapped in struct which implement Tasker interface by unnamed pointer
type IntervalTask struct { *TaskBase variables... }
type TaskType ¶ added in v0.0.5
type TaskType uint
TaskType is used to indicate type of task
const ( // TaskTypeManual indicates task will schedule manually TaskTypeManual TaskType = 0 // TaskTypeOnAccept indicates task will schedule after tcp connection was established TaskTypeOnAccept TaskType = 1 << iota // TaskTypeOnChannel indicates task will schedule after data received from the channel TaskTypeOnChannel // TaskTypeOnInterval indicates task will schedule on interval TaskTypeOnInterval )
Directories ¶
Path | Synopsis |
---|---|
Package client - Http Client
|
Package client - Http Client |
Package kv provide k/v storage by LevelDB
|
Package kv provide k/v storage by LevelDB |
Package s3kv provide k/v storage by S3 Resty API
|
Package s3kv provide k/v storage by S3 Resty API |