forked from chromedp/chromedp
/
types.go
159 lines (133 loc) · 4.66 KB
/
types.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
package indexeddb
import (
"errors"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// AUTOGENERATED. DO NOT EDIT.
// DatabaseWithObjectStores database with an array of object stores.
type DatabaseWithObjectStores struct {
Name string `json:"name,omitempty"` // Database name.
Version int64 `json:"version,omitempty"` // Database version.
ObjectStores []*ObjectStore `json:"objectStores,omitempty"` // Object stores in this database.
}
// ObjectStore object store.
type ObjectStore struct {
Name string `json:"name,omitempty"` // Object store name.
KeyPath *KeyPath `json:"keyPath,omitempty"` // Object store key path.
AutoIncrement bool `json:"autoIncrement,omitempty"` // If true, object store has auto increment flag set.
Indexes []*ObjectStoreIndex `json:"indexes,omitempty"` // Indexes in this object store.
}
// ObjectStoreIndex object store index.
type ObjectStoreIndex struct {
Name string `json:"name,omitempty"` // Index name.
KeyPath *KeyPath `json:"keyPath,omitempty"` // Index key path.
Unique bool `json:"unique,omitempty"` // If true, index is unique.
MultiEntry bool `json:"multiEntry,omitempty"` // If true, index allows multiple entries for a key.
}
// Key key.
type Key struct {
Type KeyType `json:"type,omitempty"` // Key type.
Number float64 `json:"number,omitempty"` // Number value.
String string `json:"string,omitempty"` // String value.
Date float64 `json:"date,omitempty"` // Date value.
Array []*Key `json:"array,omitempty"` // Array value.
}
// KeyRange key range.
type KeyRange struct {
Lower *Key `json:"lower,omitempty"` // Lower bound.
Upper *Key `json:"upper,omitempty"` // Upper bound.
LowerOpen bool `json:"lowerOpen,omitempty"` // If true lower bound is open.
UpperOpen bool `json:"upperOpen,omitempty"` // If true upper bound is open.
}
// DataEntry data entry.
type DataEntry struct {
Key *runtime.RemoteObject `json:"key,omitempty"` // Key object.
PrimaryKey *runtime.RemoteObject `json:"primaryKey,omitempty"` // Primary key object.
Value *runtime.RemoteObject `json:"value,omitempty"` // Value object.
}
// KeyPath key path.
type KeyPath struct {
Type KeyPathType `json:"type,omitempty"` // Key path type.
String string `json:"string,omitempty"` // String value.
Array []string `json:"array,omitempty"` // Array value.
}
// KeyType key type.
type KeyType string
// String returns the KeyType as string value.
func (t KeyType) String() string {
return string(t)
}
// KeyType values.
const (
KeyTypeNumber KeyType = "number"
KeyTypeString KeyType = "string"
KeyTypeDate KeyType = "date"
KeyTypeArray KeyType = "array"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t KeyType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t KeyType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *KeyType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch KeyType(in.String()) {
case KeyTypeNumber:
*t = KeyTypeNumber
case KeyTypeString:
*t = KeyTypeString
case KeyTypeDate:
*t = KeyTypeDate
case KeyTypeArray:
*t = KeyTypeArray
default:
in.AddError(errors.New("unknown KeyType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *KeyType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// KeyPathType key path type.
type KeyPathType string
// String returns the KeyPathType as string value.
func (t KeyPathType) String() string {
return string(t)
}
// KeyPathType values.
const (
KeyPathTypeNull KeyPathType = "null"
KeyPathTypeString KeyPathType = "string"
KeyPathTypeArray KeyPathType = "array"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t KeyPathType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t KeyPathType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *KeyPathType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch KeyPathType(in.String()) {
case KeyPathTypeNull:
*t = KeyPathTypeNull
case KeyPathTypeString:
*t = KeyPathTypeString
case KeyPathTypeArray:
*t = KeyPathTypeArray
default:
in.AddError(errors.New("unknown KeyPathType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *KeyPathType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}