forked from fjl/go-couchdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bulk.go
44 lines (35 loc) · 807 Bytes
/
bulk.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
package couchdb
import "encoding/json"
type bulkID struct {
ID string `json:"id"`
}
type BulkGet struct {
Docs []bulkID `json:"docs"`
}
type BulkDocsReq struct {
Docs []interface{} `json:"docs"`
}
type errorWrapper struct {
ID string `json:"id"`
Rev string `json:"rev"`
Error string `json:"error"`
Reason string `json:"reason"`
}
type docWrapper struct {
Ok json.RawMessage `json:"ok"`
Error *errorWrapper `json:"error"`
}
type bulkGetRes struct {
Id string `json:"id"`
Docs []docWrapper `json:"docs"`
}
type bulkGetResp struct {
Results []bulkGetRes
}
type BulkDocsResp struct {
OK bool `json:"ok,omitempty"`
ID string `json:"id"`
Rev string `json:"rev,omitempty"`
Error string `json:"error,omitempty"`
Reason string `json:"reason,omitempty"`
}