-
Notifications
You must be signed in to change notification settings - Fork 25
/
models.go
83 lines (71 loc) · 1.86 KB
/
models.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
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"`
}
// Indexing policy
// TODO: Ex/IncludePaths
type IndexingPolicy struct {
IndexingMode string `json: "indexingMode,omitempty"`
Automatic bool `json: "automatic,omitempty"`
}
// Database
type Database struct {
Resource
Colls string `json:"_colls,omitempty"`
Users string `json:"_users,omitempty"`
}
// Databases slice of Database elements
type Databases []Database
// First returns first database in slice
func (d Databases) First() *Database {
if len(d) == 0 {
return nil
}
return &d[0]
}
// 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"`
}
// Collection slice of Collection elements
type Collections []Collection
// First returns first database in slice
func (c Collections) First() *Collection {
if len(c) == 0 {
return nil
}
return &c[0]
}
// 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"`
}
// PartitionKeyRange partition key range model
type PartitionKeyRange struct {
Resource
PartitionKeyRangeID string `json:"id,omitempty"`
MinInclusive string `json:"minInclusive,omitempty"`
MaxInclusive string `json:"maxExclusive,omitempty"`
}