-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes_v3.go
More file actions
47 lines (38 loc) · 926 Bytes
/
Copy pathtypes_v3.go
File metadata and controls
47 lines (38 loc) · 926 Bytes
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
package jsonpath
import "encoding/json"
// Node represents RFC 9535 node (location + value)
type Node struct {
Location string `json:"location"`
Value interface{} `json:"value"`
Root interface{} `json:"-"` // document root, not serialized
}
// NodeList represents a list of nodes
type NodeList []Node
// MarshalJSON implements json.Marshaler
func (nl NodeList) MarshalJSON() ([]byte, error) {
return json.Marshal([]Node(nl))
}
// Nothing represents Nothing value (different from null)
type Nothing struct{}
func (n Nothing) String() string {
return "Nothing"
}
// LogicalType represents three-valued logic
type LogicalType int8
const (
LogicalNothing LogicalType = iota
LogicalFalse
LogicalTrue
)
func (lt LogicalType) String() string {
switch lt {
case LogicalNothing:
return "nothing"
case LogicalFalse:
return "false"
case LogicalTrue:
return "true"
default:
return "unknown"
}
}