-
Notifications
You must be signed in to change notification settings - Fork 2
/
casting.go
64 lines (48 loc) · 1.45 KB
/
casting.go
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
59
60
61
62
63
64
// Copyright 2018-2019 Liu Dong <[email protected]>.
// Licensed under the MIT license.
package fractal
import (
"github.com/spf13/cast"
)
func (c *Context) Bool(paths ...string) bool {
return cast.ToBool(c.GetValue(paths...))
}
func (c *Context) Float32(paths ...string) float32 {
return cast.ToFloat32(c.GetValue(paths...))
}
func (c *Context) Float64(paths ...string) float64 {
return cast.ToFloat64(c.GetValue(paths...))
}
func (c *Context) Int(paths ...string) int {
return cast.ToInt(c.GetValue(paths...))
}
func (c *Context) Int16(paths ...string) int16 {
return cast.ToInt16(c.GetValue(paths...))
}
func (c *Context) Int32(paths ...string) int32 {
return cast.ToInt32(c.GetValue(paths...))
}
func (c *Context) Int64(paths ...string) int64 {
return cast.ToInt64(c.GetValue(paths...))
}
func (c *Context) Int8(paths ...string) int8 {
return cast.ToInt8(c.GetValue(paths...))
}
func (c *Context) Uint(paths ...string) uint {
return cast.ToUint(c.GetValue(paths...))
}
func (c *Context) Uint16(paths ...string) uint16 {
return cast.ToUint16(c.GetValue(paths...))
}
func (c *Context) Uint32(paths ...string) uint32 {
return cast.ToUint32(c.GetValue(paths...))
}
func (c *Context) Uint64(paths ...string) uint64 {
return cast.ToUint64(c.GetValue(paths...))
}
func (c *Context) Uint8(paths ...string) uint8 {
return cast.ToUint8(c.GetValue(paths...))
}
func (c *Context) String(paths ...string) string {
return cast.ToString(c.GetValue(paths...))
}