Documentation
¶
Index ¶
- Constants
- func Assert(message string)
- func AssertTrue(assert bool, message string)
- func GetRoutineId() uint64
- func GoRoutine(function func())
- func GoRoutineInLoop(function func())
- func GoRoutineInTimer(duration time.Duration, function func())
- func GoVarLoop(n uint64, function func())
- func Profiling(port int)
- func RegisterSignalForPrintStack(sig os.Signal, callback func([]byte))
- func RegisterSignalForProfiling(sig ...os.Signal)
- type ConfigLoader
- type HandlerFunc
- type HttpRestProvider
- type HttpURL
- type LogHelper
- type LogLevel
- type RateController
- type SimpleRateController
Constants ¶
View Source
const ( DefaultSeparator = ";" GenericTypeRaw = 1 GenericTypeDate = 2 )
View Source
const ( HttpGet = "GET" HttpPost = "POST" HttpUpdate = "UPDATE" )
View Source
const ( // LogDebug lowest debug LogDebug = 2 // LogTrace trace LogTrace = 4 // LogInfo trace LogInfo = 8 // LogError only error LogError = 16 // LogFatal fatal error LogFatal = 32 )
View Source
const FLAGS = log.Ldate | log.Ltime | log.Lshortfile | log.Lmicroseconds
new log files perm mode
Variables ¶
This section is empty.
Functions ¶
func AssertTrue ¶
func GetRoutineId ¶
func GetRoutineId() uint64
func GoRoutineInLoop ¶
func GoRoutineInLoop(function func())
func GoRoutineInTimer ¶
Types ¶
type ConfigLoader ¶
type ConfigLoader struct {
// contains filtered or unexported fields
}
ConfigLoader load config from file
func (*ConfigLoader) Load ¶
func (loader *ConfigLoader) Load(target interface{}) error
Load load config from file to target's field by reflect
func (*ConfigLoader) SetDateFormat ¶
func (loader *ConfigLoader) SetDateFormat(format string)
func (*ConfigLoader) SetSliceSeparator ¶
func (loader *ConfigLoader) SetSliceSeparator(sep string)
type HandlerFunc ¶
type HandlerFunc func(body []byte) interface{}
type HttpRestProvider ¶
type HttpRestProvider struct {
// contains filtered or unexported fields
}
func NewHttpRestProvider ¶
func NewHttpRestProvider(port int) *HttpRestProvider
func (*HttpRestProvider) Listen ¶
func (rest *HttpRestProvider) Listen() error
func (*HttpRestProvider) RegisterAPI ¶
func (rest *HttpRestProvider) RegisterAPI(url string, method string, handler func(body []byte) interface{})
type LogHelper ¶
type LogHelper struct { LogFileNames [2]string // file names include .log and .log.wf Logger [2]*log.Logger // logger handle Level LogLevel }
LogHelper global logger instance
type RateController ¶
type SimpleRateController ¶
type SimpleRateController struct {
// contains filtered or unexported fields
}
SimpleRateController. simply increase a inner counter and block if the counter grew up to it's threshold and yield current routine for a while
func NewSimpleRateController ¶
func NewSimpleRateController() *SimpleRateController
func (*SimpleRateController) Control ¶
func (controller *SimpleRateController) Control(threshold, n int64) bool
Click to show internal directories.
Click to hide internal directories.