@@ -29,17 +29,14 @@ public extension Query {
29
29
}
30
30
31
31
/**
32
- Finds objects *asynchronously* and publishes when complete.
33
- - parameter explain: Used to toggle the information on the query plan.
32
+ Query plan information for finding objects *asynchronously* and publishes when complete.
34
33
- parameter options: A set of header options sent to the server. Defaults to an empty set.
35
34
- returns: A publisher that eventually produces a single value and then finishes or fails.
36
35
*/
37
- func findPublisher< U: Decodable > ( explain: Bool ,
38
- options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
36
+ func findExplainPublisher< U: Decodable > ( options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
39
37
Future { promise in
40
- self . find ( explain: explain,
41
- options: options,
42
- completion: promise)
38
+ self . findExplain ( options: options,
39
+ completion: promise)
43
40
}
44
41
}
45
42
@@ -74,17 +71,14 @@ public extension Query {
74
71
}
75
72
76
73
/**
77
- Gets an object *asynchronously* and publishes when complete.
78
- - parameter explain: Used to toggle the information on the query plan.
74
+ Query plan information for getting an object *asynchronously* and publishes when complete.
79
75
- parameter options: A set of header options sent to the server. Defaults to an empty set.
80
76
- returns: A publisher that eventually produces a single value and then finishes or fails.
81
77
*/
82
- func firstPublisher< U: Decodable > ( explain: Bool ,
83
- options: API . Options = [ ] ) -> Future < U , ParseError > {
78
+ func firstExplainPublisher< U: Decodable > ( options: API . Options = [ ] ) -> Future < U , ParseError > {
84
79
Future { promise in
85
- self . first ( explain: explain,
86
- options: options,
87
- completion: promise)
80
+ self . firstExplain ( options: options,
81
+ completion: promise)
88
82
}
89
83
}
90
84
@@ -101,35 +95,81 @@ public extension Query {
101
95
}
102
96
103
97
/**
104
- Count objects *asynchronously* and publishes when complete.
98
+ Query plan information for counting objects *asynchronously* and publishes when complete.
105
99
- parameter explain: Used to toggle the information on the query plan.
106
100
- parameter options: A set of header options sent to the server. Defaults to an empty set.
107
101
- returns: A publisher that eventually produces a single value and then finishes or fails.
108
102
*/
109
- func countPublisher< U: Decodable > ( explain: Bool ,
110
- options: API . Options = [ ] ) -> Future < U , ParseError > {
103
+ func countExplainPublisher< U: Decodable > ( options: API . Options = [ ] ) -> Future < U , ParseError > {
111
104
Future { promise in
112
- self . count ( explain: explain,
113
- options: options,
114
- completion: promise)
105
+ self . countExplain ( options: options,
106
+ completion: promise)
115
107
}
116
108
}
117
109
118
110
/**
119
111
Executes an aggregate query *asynchronously* and publishes when complete.
120
- - requires: `.useMasterKey` has to be available and passed as one of the set of `options` .
112
+ - requires: `.useMasterKey` has to be available.
121
113
- parameter pipeline: A pipeline of stages to process query.
122
114
- parameter options: A set of header options sent to the server. Defaults to an empty set.
123
115
- returns: A publisher that eventually produces a single value and then finishes or fails.
124
116
*/
125
- func aggregatePublisher( _ pipeline: AggregateType ,
117
+ func aggregatePublisher( _ pipeline: [ [ String : Encodable ] ] ,
126
118
options: API . Options = [ ] ) -> Future < [ ResultType ] , ParseError > {
127
119
Future { promise in
128
120
self . aggregate ( pipeline,
129
121
options: options,
130
122
completion: promise)
131
123
}
132
124
}
125
+
126
+ /**
127
+ Query plan information for executing an aggregate query *asynchronously* and publishes when complete.
128
+ - requires: `.useMasterKey` has to be available.
129
+ - parameter pipeline: A pipeline of stages to process query.
130
+ - parameter options: A set of header options sent to the server. Defaults to an empty set.
131
+ - returns: A publisher that eventually produces a single value and then finishes or fails.
132
+ */
133
+ func aggregateExplainPublisher< U: Decodable > ( _ pipeline: [ [ String : Encodable ] ] ,
134
+ options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
135
+ Future { promise in
136
+ self . aggregateExplain ( pipeline,
137
+ options: options,
138
+ completion: promise)
139
+ }
140
+ }
141
+
142
+ /**
143
+ Executes a distinct query *asynchronously* and publishes unique values when complete.
144
+ - requires: `.useMasterKey` has to be available.
145
+ - parameter key: A field to find distinct values.
146
+ - parameter options: A set of header options sent to the server. Defaults to an empty set.
147
+ - returns: A publisher that eventually produces a single value and then finishes or fails.
148
+ */
149
+ func distinctPublisher( _ key: String ,
150
+ options: API . Options = [ ] ) -> Future < [ ResultType ] , ParseError > {
151
+ Future { promise in
152
+ self . distinct ( key,
153
+ options: options,
154
+ completion: promise)
155
+ }
156
+ }
157
+
158
+ /**
159
+ Query plan information for executing a distinct query *asynchronously* and publishes unique values when complete.
160
+ - requires: `.useMasterKey` has to be available.
161
+ - parameter key: A field to find distinct values.
162
+ - parameter options: A set of header options sent to the server. Defaults to an empty set.
163
+ - returns: A publisher that eventually produces a single value and then finishes or fails.
164
+ */
165
+ func distinctExplainPublisher< U: Decodable > ( _ key: String ,
166
+ options: API . Options = [ ] ) -> Future < [ U ] , ParseError > {
167
+ Future { promise in
168
+ self . distinctExplain ( key,
169
+ options: options,
170
+ completion: promise)
171
+ }
172
+ }
133
173
}
134
174
135
175
#endif
0 commit comments