1 Star 0 Fork 0

micro-tools/wf

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
g_func.go 2.35 KB
Copy Edit Raw Blame History
545403892 authored 2023-09-27 22:16 +08:00 . 升级go-ole
package g
import (
"gitee.com/micro-tools/wf/container/gvar"
"gitee.com/micro-tools/wf/internal/empty"
"gitee.com/micro-tools/wf/net/ghttp"
"gitee.com/micro-tools/wf/os/gproc"
"gitee.com/micro-tools/wf/util/gutil"
)
// NewVar returns a gvar.Var.
func NewVar(i interface{}, safe ...bool) *Var {
return gvar.New(i, safe...)
}
// Wait is an alias of ghttp.Wait, which blocks until all the web servers shutdown.
// It's commonly used in multiple servers situation.
func Wait() {
ghttp.Wait()
}
// Listen is an alias of gproc.Listen, which handles the signals received and automatically
// calls registered signal handler functions.
// It blocks until shutdown signals received and all registered shutdown handlers done.
func Listen() {
gproc.Listen()
}
// Dump dumps a variable to stdout with more manually readable.
func Dump(i ...interface{}) {
gutil.Dump(i...)
}
// Export exports a variable to string with more manually readable.
func Export(i ...interface{}) string {
return gutil.Export(i...)
}
// Throw throws a exception, which can be caught by TryCatch function.
// It always be used in TryCatch function.
func Throw(exception interface{}) {
gutil.Throw(exception)
}
// Try implements try... logistics using internal panic...recover.
// It returns error if any exception occurs, or else it returns nil.
func Try(try func()) (err error) {
return gutil.Try(try)
}
// TryCatch implements try...catch... logistics using internal panic...recover.
// It automatically calls function <catch> if any exception occurs ans passes the exception as an error.
func TryCatch(try func(), catch ...func(exception error)) {
gutil.TryCatch(try, catch...)
}
// IsNil checks whether given <value> is nil.
// Parameter <traceSource> is used for tracing to the source variable if given <value> is type
// of a pinter that also points to a pointer. It returns nil if the source is nil when <traceSource>
// is true.
// Note that it might use reflect feature which affects performance a little bit.
func IsNil(value interface{}, traceSource ...bool) bool {
return empty.IsNil(value, traceSource...)
}
// IsEmpty checks whether given <value> empty.
// It returns true if <value> is in: 0, nil, false, "", len(slice/map/chan) == 0.
// Or else it returns true.
func IsEmpty(value interface{}) bool {
return empty.IsEmpty(value)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/micro-tools/wf.git
git@gitee.com:micro-tools/wf.git
micro-tools
wf
wf
v1.0.2

Search