@@ -133,9 +133,11 @@ public func <= <T>(key: String, value: T) -> QueryConstraint where T: Codable {
133133 - parameter value: The value to compare.
134134 - returns: The same instance of `QueryConstraint` as the receiver.
135135 - warning: See `equalTo` for more information.
136- Behavior changes based on `ParseSwift.configuration.isUsingEqualQueryConstraint`
137- where isUsingEqualQueryConstraint == true is known not to work for LiveQuery on
138- Parse Servers <= 5.0.0.
136+ This method uses `$eq` and can
137+ be combined with all other `QueryConstaint`'s. It has the limitation of
138+ not to working for LiveQuery on Parse Servers `< 6.3.0`. If you are using
139+ an older Parse Server, you should use `equalToNoComparator()`
140+ instead.
139141 */
140142public func == < T> ( key: String , value: T ) -> QueryConstraint where T: Codable {
141143 equalTo ( key: key, value: value)
@@ -145,23 +147,33 @@ public func == <T>(key: String, value: T) -> QueryConstraint where T: Codable {
145147 Add a constraint that requires that a key is equal to a value.
146148 - parameter key: The key that the value is stored in.
147149 - parameter value: The value to compare.
148- - parameter usingEqComparator: Set to **true** to use **$eq** comparater,
149- allowing for multiple `QueryConstraint`'s to be used on a single **key**.
150- Setting to *false* may override any `QueryConstraint`'s on the same **key**.
151- Defaults to `ParseSwift.configuration.isUsingEqualQueryConstraint`.
152150 - returns: The same instance of `QueryConstraint` as the receiver.
153- - warning: `usingEqComparator == true` is known not to work for LiveQueries
154- on Parse Servers <= 5.0.0.
155- */
156- public func equalTo < T> ( key: String ,
157- value: T ,
158- // swiftlint:disable:next line_length
159- usingEqComparator: Bool = configuration. isUsingEqualQueryConstraint) -> QueryConstraint where T: Codable {
160- if !usingEqComparator {
161- return QueryConstraint ( key: key, value: value)
162- } else {
163- return QueryConstraint ( key: key, value: value, comparator: . equalTo)
164- }
151+ - warning: This method uses `$eq` and can
152+ be combined with all other `QueryConstaint`'s. It has the limitation of
153+ not to working for LiveQuery on Parse Servers `< 6.3.0`. If you are using
154+ an older Parse Server, you should use `equalToNoComparator()`
155+ instead.
156+ */
157+ public func equalTo< T> (
158+ key: String ,
159+ value: T
160+ ) -> QueryConstraint where T: Codable {
161+ QueryConstraint ( key: key, value: value, comparator: . equalTo)
162+ }
163+
164+ /**
165+ Add a constraint that requires that a key is equal to a value.
166+ - parameter key: The key that the value is stored in.
167+ - parameter value: The value to compare.
168+ - returns: The same instance of `QueryConstraint` as the receiver.
169+ - warning: This `QueryConstaint` has the limitation of being able to be combined
170+ with other `QueryConstraint`'s. It does however work with all versions of LiveQuery.
171+ */
172+ public func equalToNoComparator< T> (
173+ key: String ,
174+ value: T
175+ ) -> QueryConstraint where T: Codable {
176+ QueryConstraint ( key: key, value: value)
165177}
166178
167179/**
@@ -171,9 +183,11 @@ public func equalTo <T>(key: String,
171183 - returns: The same instance of `QueryConstraint` as the receiver.
172184 - throws: An error of type `ParseError`.
173185 - warning: See `equalTo` for more information.
174- Behavior changes based on `ParseSwift.configuration.isUsingEqualQueryConstraint`
175- where isUsingEqualQueryConstraint == true is known not to work for LiveQuery on
176- Parse Servers <= 5.0.0.
186+ This method uses `$eq` and can
187+ be combined with all other `QueryConstaint`'s. It has the limitation of
188+ not to working for LiveQuery on Parse Servers `< 6.3.0`. If you are using
189+ an older Parse Server, you should use `equalToNoComparator()`
190+ instead.
177191 */
178192public func == < T> ( key: String , object: T ) throws -> QueryConstraint where T: ParseObject {
179193 try equalTo ( key: key, object: object)
@@ -183,24 +197,39 @@ public func == <T>(key: String, object: T) throws -> QueryConstraint where T: Pa
183197 Add a constraint that requires that a key is equal to a `ParseObject`.
184198 - parameter key: The key that the value is stored in.
185199 - parameter object: The `ParseObject` to compare.
186- - parameter usingEqComparator: Set to **true** to use **$eq** comparater,
187- allowing for multiple `QueryConstraint`'s to be used on a single **key**.
188- Setting to *false* may override any `QueryConstraint`'s on the same **key**.
189- Defaults to `ParseSwift.configuration.isUsingEqualQueryConstraint`.
190200 - returns: The same instance of `QueryConstraint` as the receiver.
191201 - throws: An error of type `ParseError`.
192- - warning: `usingEqComparator == true` is known not to work for LiveQueries
193- on Parse Servers <= 5.0.0.
194- */
195- public func equalTo < T> ( key: String ,
196- object: T ,
197- // swiftlint:disable:next line_length
198- usingEqComparator: Bool = configuration. isUsingEqualQueryConstraint) throws -> QueryConstraint where T: ParseObject {
199- if !usingEqComparator {
200- return try QueryConstraint ( key: key, value: object. toPointer ( ) )
201- } else {
202- return try QueryConstraint ( key: key, value: object. toPointer ( ) , comparator: . equalTo)
203- }
202+ - warning: This method uses `$eq` and can
203+ be combined with all other `QueryConstaint`'s. It has the limitation of
204+ not to working for LiveQuery on Parse Servers `< 6.3.0`. If you are using
205+ an older Parse Server, you should use `equalToNoComparator()`
206+ instead.
207+ */
208+ public func equalTo< T> (
209+ key: String ,
210+ object: T
211+ ) throws -> QueryConstraint where T: ParseObject {
212+ try QueryConstraint (
213+ key: key,
214+ value: object. toPointer ( ) ,
215+ comparator: . equalTo
216+ )
217+ }
218+
219+ /**
220+ Add a constraint that requires that a key is equal to a `ParseObject`.
221+ - parameter key: The key that the value is stored in.
222+ - parameter object: The `ParseObject` to compare.
223+ - returns: The same instance of `QueryConstraint` as the receiver.
224+ - throws: An error of type `ParseError`.
225+ - warning: This `QueryConstaint` has the limitation of being able to be combined
226+ with other `QueryConstraint`'s. It does however work with all versions of LiveQuery.
227+ */
228+ public func equalToNoComparator< T> (
229+ key: String ,
230+ object: T
231+ ) throws -> QueryConstraint where T: ParseObject {
232+ try QueryConstraint ( key: key, value: object. toPointer ( ) )
204233}
205234
206235/**
0 commit comments