@@ -2,52 +2,95 @@ package documentdb
2
2
3
3
// Resource
4
4
type Resource struct {
5
- Id string `json:"id,omitempty"`
6
- Self string `json:"_self,omitempty"`
7
- Etag string `json:"_etag,omitempty"`
8
- Rid string `json:"_rid,omitempty"`
9
- Ts int `json:"_ts,omitempty"`
5
+ Id string `json:"id,omitempty"`
6
+ Self string `json:"_self,omitempty"`
7
+ Etag string `json:"_etag,omitempty"`
8
+ Rid string `json:"_rid,omitempty"`
9
+ Ts int `json:"_ts,omitempty"`
10
10
}
11
11
12
+ type IndexingMode string
13
+
14
+ const (
15
+ Consistent = IndexingMode ("Consistent" )
16
+ Lazy = IndexingMode ("Lazy" )
17
+ )
18
+
12
19
// Indexing policy
13
- // TODO: Ex/IncludePaths
14
20
type IndexingPolicy struct {
15
- IndexingMode string `json: "indexingMode,omitempty"`
16
- Automatic bool `json: "automatic,omitempty"`
21
+ IndexingMode IndexingMode `json:"indexingMode,omitempty"`
22
+ Automatic bool `json:"automatic"`
23
+ Included []IncludedPath `json:"includedPaths,omitempty"`
24
+ Excluded []ExcludedPath `json:"excludedPaths,omitempty"`
25
+ }
26
+
27
+ type DataType string
28
+
29
+ const (
30
+ StringType = DataType ("String" )
31
+ NumberType = DataType ("Number" )
32
+ PointType = DataType ("Point" )
33
+ PolygonType = DataType ("Polygon" )
34
+ LineStringType = DataType ("LineString" )
35
+ )
36
+
37
+ type IndexKind string
38
+
39
+ const (
40
+ Hash = IndexKind ("Hash" )
41
+ Range = IndexKind ("Range" )
42
+ Spatial = IndexKind ("Spatial" )
43
+ )
44
+
45
+ const MaxPrecision = - 1
46
+
47
+ type Index struct {
48
+ DataType DataType `json:"dataType,omitempty"`
49
+ Kind IndexKind `json:"kind,omitempty"`
50
+ Precision int `json:"precision,omitempty"`
51
+ }
52
+
53
+ type IncludedPath struct {
54
+ Path string `json:"path"`
55
+ Indexes []Index `json:"indexes,omitempty"`
56
+ }
57
+
58
+ type ExcludedPath struct {
59
+ Path string `json:"path"`
17
60
}
18
61
19
62
// Database
20
63
type Database struct {
21
64
Resource
22
- Colls string `json:"_colls,omitempty"`
23
- Users string `json:"_users,omitempty"`
65
+ Colls string `json:"_colls,omitempty"`
66
+ Users string `json:"_users,omitempty"`
24
67
}
25
68
26
69
// Collection
27
70
type Collection struct {
28
71
Resource
29
- IndexingPolicy IndexingPolicy `json:"indexingPolicy,omitempty"`
30
- Docs string `json:"_docs,omitempty"`
31
- Udf string `json:"_udfs,omitempty"`
32
- Sporcs string `json:"_sporcs,omitempty"`
33
- Triggers string `json:"_triggers,omitempty"`
34
- Conflicts string `json:"_conflicts,omitempty"`
72
+ IndexingPolicy * IndexingPolicy `json:"indexingPolicy,omitempty"`
73
+ Docs string `json:"_docs,omitempty"`
74
+ Udf string `json:"_udfs,omitempty"`
75
+ Sporcs string `json:"_sporcs,omitempty"`
76
+ Triggers string `json:"_triggers,omitempty"`
77
+ Conflicts string `json:"_conflicts,omitempty"`
35
78
}
36
79
37
80
// Document
38
81
type Document struct {
39
82
Resource
40
- attachments string `json: "attachments,omitempty"`
83
+ Attachments string `json:"attachments,omitempty"`
41
84
}
42
85
43
86
// Stored Procedure
44
87
type Sproc struct {
45
88
Resource
46
- Body string `json:"body,omitempty"`
89
+ Body string `json:"body,omitempty"`
47
90
}
48
91
49
92
// User Defined Function
50
93
type UDF struct {
51
94
Resource
52
- Body string `json:"body,omitempty"`
95
+ Body string `json:"body,omitempty"`
53
96
}
0 commit comments