-
Notifications
You must be signed in to change notification settings - Fork 1
/
unmarshal-type-uoctal.go
63 lines (52 loc) · 1.89 KB
/
unmarshal-type-uoctal.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
package argo
import "strconv"
// UOctal represents an untyped unsigned int value that is
// expected to be input in octal notation and will be parsed
// from string in base 8.
type UOctal uint
// Unmarshal implements the Unmarshaler.Unmarshal method for the UOctal type.
func (o *UOctal) Unmarshal(value string) (err error) {
tmp, err := strconv.ParseUint(value, 8, strconv.IntSize)
*o = UOctal(tmp)
return
}
// UOctal8 represents an unsigned 8 bit int value that is
// expected to be input in octal notation and will be parsed
// from string in base 8.
type UOctal8 uint8
// Unmarshal implements the Unmarshaler.Unmarshal method for the UOctal8 type.
func (o *UOctal8) Unmarshal(value string) (err error) {
tmp, err := strconv.ParseUint(value, 8, 8)
*o = UOctal8(tmp)
return
}
// UOctal16 represents an unsigned 16 bit int value that is
// expected to be input in octal notation and will be parsed
// from string in base 8.
type UOctal16 uint16
// Unmarshal implements the Unmarshaler.Unmarshal method for the UOctal16 type.
func (o *UOctal16) Unmarshal(value string) (err error) {
tmp, err := strconv.ParseUint(value, 8, 16)
*o = UOctal16(tmp)
return
}
// UOctal32 represents an unsigned 32 bit int value that is
// expected to be input in octal notation and will be parsed
// from string in base 8.
type UOctal32 uint32
// Unmarshal implements the Unmarshaler.Unmarshal method for the UOctal32 type.
func (o *UOctal32) Unmarshal(value string) (err error) {
tmp, err := strconv.ParseUint(value, 8, 32)
*o = UOctal32(tmp)
return
}
// UOctal64 represents an unsigned 64 bit int value that is
// expected to be input in octal notation and will be parsed
// from string in base 8.
type UOctal64 uint64
// Unmarshal implements the Unmarshaler.Unmarshal method for the UOctal64 type.
func (o *UOctal64) Unmarshal(value string) (err error) {
tmp, err := strconv.ParseUint(value, 8, 64)
*o = UOctal64(tmp)
return
}