File tree Expand file tree Collapse file tree 1 file changed +38
-3
lines changed
Expand file tree Collapse file tree 1 file changed +38
-3
lines changed Original file line number Diff line number Diff line change 11package requests
22
3- import "fmt"
4-
53// ImportCollection imports data to a collection
64type ImportCollection struct {
75 CollectionName string
86 Data []byte
7+ FromPrefix string
8+ ToPrefix string
9+ Overwrite bool
10+ WaitForSync bool
11+ OnDuplicate string
12+ Complete bool
13+ Details bool
914}
1015
1116func (c * ImportCollection ) Path () string {
12- return fmt .Sprintf ("/_api/import/?type=auto&collection=%s" , c .CollectionName )
17+ path := "/_api/import/?type=auto&collection=" + c .CollectionName
18+
19+ if c .FromPrefix != "" {
20+ path += "&fromPrefix=" + c .FromPrefix
21+ }
22+
23+ if c .ToPrefix != "" {
24+ path += "&toPrefix=" + c .ToPrefix
25+ }
26+
27+ if c .Overwrite {
28+ path += "&overwrite=yes"
29+ }
30+
31+ if c .WaitForSync {
32+ path += "&waitForSync=yes"
33+ }
34+
35+ if c .OnDuplicate != "" {
36+ path += "&onDuplicate=" + c .OnDuplicate
37+ }
38+
39+ if c .Complete {
40+ path += "&complete=yes"
41+ }
42+
43+ if c .Details {
44+ path += "&details=yes"
45+ }
46+
47+ return path
1348}
1449
1550func (c * ImportCollection ) Method () string {
You can’t perform that action at this time.
0 commit comments