Repository navigation
Expand file tree
/
Copy pathg_func.go
More file actions
58 lines (48 loc) · 1.58 KB
/
Copy pathg_func.go
File metadata and controls
58 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package g
import (
"github.com/gogf/gf/container/gvar"
"github.com/gogf/gf/internal/empty"
"github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/util/gutil"
)
// NewVar returns a gvar.Var.
func NewVar(i interface{}, safe ...bool) *Var {
return gvar.New(i, safe...)
}
// Wait blocks until all the web servers shutdown.
func Wait() {
ghttp.Wait()
}
// 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)
}
// TryCatch does the try...catch... mechanism.
func TryCatch(try func(), catch ...func(exception interface{})) {
gutil.TryCatch(try, catch...)
}
// IsNil checks whether given <value> is nil.
// Note that it might use reflect feature which affects performance a little bit.
func IsNil(value interface{}) bool {
return empty.IsNil(value)
}
// 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)
}