-
Notifications
You must be signed in to change notification settings - Fork 1
/
value.go
57 lines (45 loc) · 1.39 KB
/
value.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
package xmlrpc
import "time"
// Kind represents the specific kind of value that a Value wraps.
// The zero Kind represents an invalid Value.
type Kind uint
const (
Invalid Kind = iota
Array
Base64
Bool
DateTime
Double
Int
String
Struct
)
// Value is a wrapper around an actual XML-RPC value.
type Value interface {
// Values returns the value's underlying value, as a slice.
// It panics if the value's Kind is not Array.
Values() []Value
// Bytes returns the value's underlying value, as a slice of byte.
// It panics if the value's Kind is not Base64.
Bytes() []byte
// Bool returns the value's underlying value, as a bool.
// It panics if the value's Kind is not Bool.
Bool() bool
// Time returns the value's underlying value, as a time.Time.
// It panics if the value's Kind is not DateTime.
Time() time.Time
// Double returns the value's underlying value, as a float64.
// It panics if the value's Kind is not Double.
Double() float64
// Int returns the value's underlying value, as an int.
// It panics if the value's Kind is not Int.
Int() int
// Text returns the value's underlying value, as a string.
// It panics if the value's Kind is not String.
Text() string
// Members returns the value's underlying value, as a slice of Member.
// It panics if the value's Kind is not Struct.
Members() []Member
// Kind returns the specific type of this value.
Kind() Kind
}