-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser_methods.go
36 lines (33 loc) · 1009 Bytes
/
parser_methods.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
package envloader
import "strconv"
type parsers struct{}
func (parsers) ParseString(val string) (interface{}, error) {
return val, nil
}
func (parsers) ParseInterface(val string) (interface{}, error) {
return val, nil
}
func (parsers) ParseBool(val string) (interface{}, error) {
return strconv.ParseBool(val)
}
func (parsers) ParseInt(val string) (interface{}, error) {
return strconv.Atoi(val)
}
func (parsers) ParseInt8(val string) (interface{}, error) {
return strconv.ParseInt(val, 10, 8)
}
func (parsers) ParseInt16(val string) (interface{}, error) {
return strconv.ParseInt(val, 10, 16)
}
func (parsers) ParseInt32(val string) (interface{}, error) {
return strconv.ParseInt(val, 10, 32)
}
func (parsers) ParseInt64(val string) (interface{}, error) {
return strconv.ParseInt(val, 10, 64)
}
func (parsers) ParseFloat32(val string) (interface{}, error) {
return strconv.ParseFloat(val, 32)
}
func (parsers) ParseFloat64(val string) (interface{}, error) {
return strconv.ParseFloat(val, 64)
}