This repository was archived by the owner on May 3, 2026. It is now read-only.
forked from a8m/documentdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.go
More file actions
96 lines (79 loc) · 2.11 KB
/
models.go
File metadata and controls
96 lines (79 loc) · 2.11 KB
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
package documentdb
// Resource
type Resource struct {
Id string `json:"id,omitempty"`
Self string `json:"_self,omitempty"`
Etag string `json:"_etag,omitempty"`
Rid string `json:"_rid,omitempty"`
Ts int `json:"_ts,omitempty"`
}
type IndexingMode string
const (
Consistent = IndexingMode("Consistent")
Lazy = IndexingMode("Lazy")
)
// Indexing policy
type IndexingPolicy struct {
IndexingMode IndexingMode `json:"indexingMode,omitempty"`
Automatic bool `json:"automatic"`
Included []IncludedPath `json:"includedPaths,omitempty"`
Excluded []ExcludedPath `json:"excludedPaths,omitempty"`
}
type DataType string
const (
StringType = DataType("String")
NumberType = DataType("Number")
PointType = DataType("Point")
PolygonType = DataType("Polygon")
LineStringType = DataType("LineString")
)
type IndexKind string
const (
Hash = IndexKind("Hash")
Range = IndexKind("Range")
Spatial = IndexKind("Spatial")
)
const MaxPrecision = -1
type Index struct {
DataType DataType `json:"dataType,omitempty"`
Kind IndexKind `json:"kind,omitempty"`
Precision int `json:"precision,omitempty"`
}
type IncludedPath struct {
Path string `json:"path"`
Indexes []Index `json:"indexes,omitempty"`
}
type ExcludedPath struct {
Path string `json:"path"`
}
// Database
type Database struct {
Resource
Colls string `json:"_colls,omitempty"`
Users string `json:"_users,omitempty"`
}
// Collection
type Collection struct {
Resource
IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"`
Docs string `json:"_docs,omitempty"`
Udf string `json:"_udfs,omitempty"`
Sporcs string `json:"_sporcs,omitempty"`
Triggers string `json:"_triggers,omitempty"`
Conflicts string `json:"_conflicts,omitempty"`
}
// Document
type Document struct {
Resource
Attachments string `json:"attachments,omitempty"`
}
// Stored Procedure
type Sproc struct {
Resource
Body string `json:"body,omitempty"`
}
// User Defined Function
type UDF struct {
Resource
Body string `json:"body,omitempty"`
}