From 43304587141f35c49c090addc9ec71b1d49cb24c Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 3 Jan 2022 01:04:57 -0500 Subject: [PATCH 1/9] feat: adds equalTo QueryConstraint along which uses $eq --- CHANGELOG.md | 3 +- .../Contents.swift | 2 +- .../Contents.swift | 2 +- Sources/ParseSwift/Parse.swift | 12 ++++ .../ParseSwift/Types/QueryConstraint.swift | 63 ++++++++++++++++++- Tests/ParseSwiftTests/ParseQueryTests.swift | 20 +++++- 6 files changed, 95 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 785578fc3..0f211259b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ __New features__ - (Breaking Change) Adds options to matchesText QueryConstraint along with the ability to see matching score. The compiler should recommend the new score property to all ParseObjects ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds withCount query ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). -- Adds isNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). +- Adds isNull and isNotNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). +- Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). __Improvements__ - Improve QueryWhere by making at a set of QueryConstraint's instead of any array. This dedupes the same constraint when encoding the query; improving the encoding speed when the same constraints are added ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). diff --git a/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift index c53882961..96708e2e9 100644 --- a/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift @@ -73,7 +73,7 @@ do { } //: Query all scores whose is null or undefined. -let query1 = GameScore.query(notNull(key: "name")) +let query1 = GameScore.query(isNotNull(key: "name")) let results1 = try query1.find() print("Total found: \(results1.count)") results1.forEach { score in diff --git a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift index f5a9c5646..67b4cc543 100644 --- a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift @@ -192,7 +192,7 @@ query4.find { results in } //: Get the same results as the previous query whose location is not null or undefined. -var anotherQuery4 = GameScore.query("points" > 9, notNull(key: "location")) +var anotherQuery4 = GameScore.query("points" > 9, isNotNull(key: "location")) anotherQuery4.find { results in switch results { case .success(let scores): diff --git a/Sources/ParseSwift/Parse.swift b/Sources/ParseSwift/Parse.swift index bd41faccd..3a0aaba5b 100644 --- a/Sources/ParseSwift/Parse.swift +++ b/Sources/ParseSwift/Parse.swift @@ -30,6 +30,10 @@ public struct ParseConfiguration { /// - warning: This is experimental. public internal(set) var useTransactions = false + /// Use the **$eq** query constraint when querying. + /// - warning: This is known not to work for LiveQueries on Parse Servers < 5.0.0. + public internal(set) var isUsingEqualQueryConstraint = false + /// The default caching policy for all http requests that determines when to /// return a response from the cache. Defaults to `useProtocolCachePolicy`. /// See Apple's [documentation](https://developer.apple.com/documentation/foundation/url_loading_system/accessing_cached_data) @@ -76,6 +80,7 @@ public struct ParseConfiguration { - parameter allowCustomObjectId: Allows objectIds to be created on the client. side for each object. Must be enabled on the server to work. - parameter useTransactions: Use transactions when saving/updating multiple objects. + - parameter isUsingEqualQueryConstraint: Use the **$eq** query constraint when querying. - parameter keyValueStore: A key/value store that conforms to the `ParseKeyValueStore` protocol. Defaults to `nil` in which one will be created an memory, but never persisted. For Linux, this this is the only store available since there is no Keychain. Linux users should replace this store with an @@ -108,6 +113,7 @@ public struct ParseConfiguration { liveQueryServerURL: URL? = nil, allowCustomObjectId: Bool = false, useTransactions: Bool = false, + isUsingEqualQueryConstraint: Bool = false, keyValueStore: ParseKeyValueStore? = nil, requestCachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, cacheMemoryCapacity: Int = 512_000, @@ -126,6 +132,7 @@ public struct ParseConfiguration { self.liveQuerysServerURL = liveQueryServerURL self.allowCustomObjectId = allowCustomObjectId self.useTransactions = useTransactions + self.isUsingEqualQueryConstraint = isUsingEqualQueryConstraint self.mountPath = "/" + serverURL.pathComponents .filter { $0 != "/" } .joined(separator: "/") @@ -237,6 +244,7 @@ public struct ParseSwift { - parameter allowCustomObjectId: Allows objectIds to be created on the client. side for each object. Must be enabled on the server to work. - parameter useTransactions: Use transactions when saving/updating multiple objects. + - parameter isUsingEqualQueryConstraint: Use the **$eq** query constraint when querying. - parameter keyValueStore: A key/value store that conforms to the `ParseKeyValueStore` protocol. Defaults to `nil` in which one will be created an memory, but never persisted. For Linux, this this is the only store available since there is no Keychain. Linux users should replace this store with an @@ -268,6 +276,7 @@ public struct ParseSwift { liveQueryServerURL: URL? = nil, allowCustomObjectId: Bool = false, useTransactions: Bool = false, + isUsingEqualQueryConstraint: Bool = false, keyValueStore: ParseKeyValueStore? = nil, requestCachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, cacheMemoryCapacity: Int = 512_000, @@ -287,6 +296,7 @@ public struct ParseSwift { liveQueryServerURL: liveQueryServerURL, allowCustomObjectId: allowCustomObjectId, useTransactions: useTransactions, + isUsingEqualQueryConstraint: isUsingEqualQueryConstraint, keyValueStore: keyValueStore, requestCachePolicy: requestCachePolicy, cacheMemoryCapacity: cacheMemoryCapacity, @@ -305,6 +315,7 @@ public struct ParseSwift { liveQueryServerURL: URL? = nil, allowCustomObjectId: Bool = false, useTransactions: Bool = false, + isUsingEqualQueryConstraint: Bool = false, keyValueStore: ParseKeyValueStore? = nil, requestCachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, cacheMemoryCapacity: Int = 512_000, @@ -324,6 +335,7 @@ public struct ParseSwift { liveQueryServerURL: liveQueryServerURL, allowCustomObjectId: allowCustomObjectId, useTransactions: useTransactions, + isUsingEqualQueryConstraint: isUsingEqualQueryConstraint, keyValueStore: keyValueStore, requestCachePolicy: requestCachePolicy, cacheMemoryCapacity: cacheMemoryCapacity, diff --git a/Sources/ParseSwift/Types/QueryConstraint.swift b/Sources/ParseSwift/Types/QueryConstraint.swift index f9fe9d87d..0055c7378 100644 --- a/Sources/ParseSwift/Types/QueryConstraint.swift +++ b/Sources/ParseSwift/Types/QueryConstraint.swift @@ -7,6 +7,7 @@ // import Foundation +import UIKit /// Used to constrain a query. public struct QueryConstraint: Encodable, Hashable { @@ -15,6 +16,7 @@ public struct QueryConstraint: Encodable, Hashable { case lessThanOrEqualTo = "$lte" case greaterThan = "$gt" case greaterThanOrEqualTo = "$gte" + case equalTo = "$eq" case notEqualTo = "$ne" case containedIn = "$in" case notContainedIn = "$nin" @@ -136,9 +138,36 @@ public func <= (key: String, value: T) -> QueryConstraint where T: Encodable - parameter key: The key that the value is stored in. - parameter value: The value to compare. - returns: The same instance of `QueryConstraint` as the receiver. + - warning: See `equalTo` for more information. + Behavior changes based on `ParseSwift.configuration.isUsingEqualQueryConstraint` + where isUsingEqualQueryConstraint == true is known not to work for LiveQueries on + Parse Servers <= 5.0.0. */ public func == (key: String, value: T) -> QueryConstraint where T: Encodable { - QueryConstraint(key: key, value: value) + equalTo(key: key, value: value) +} + +/** + Add a constraint that requires that a key is equal to a value. + - parameter key: The key that the value is stored in. + - parameter value: The value to compare. + - parameter isUsingEQ: Set to **true** to use **$eq** comparater, + allowing for multiple `QueryConstraint`'s to be used on a single **key**. + Setting to *false* may override any `QueryConstraint`'s on the same **key**. + Defaults to `ParseSwift.configuration.isUsingEqualQueryConstraint`. + - returns: The same instance of `QueryConstraint` as the receiver. + - warning: `isUsingEQ == true` is known not to work for LiveQueries + on Parse Servers <= 5.0.0. + */ +public func equalTo (key: String, + value: T, + //swiftlint:disable:next line_length + isUsingEQ: Bool = ParseSwift.configuration.isUsingEqualQueryConstraint) -> QueryConstraint where T: Encodable { + if !isUsingEQ { + return QueryConstraint(key: key, value: value) + } else { + return QueryConstraint(key: key, value: value, comparator: .equalTo) + } } /** @@ -147,9 +176,37 @@ public func == (key: String, value: T) -> QueryConstraint where T: Encodable - parameter value: The `ParseObject` to compare. - returns: The same instance of `QueryConstraint` as the receiver. - throws: An error of type `ParseError`. + - warning: See `equalTo` for more information. + Behavior changes based on `ParseSwift.configuration.isUsingEqualQueryConstraint` + where isUsingEqualQueryConstraint == true is known not to work for LiveQueries on + Parse Servers <= 5.0.0. */ public func == (key: String, value: T) throws -> QueryConstraint where T: ParseObject { - try QueryConstraint(key: key, value: value.toPointer()) + try equalTo(key: key, value: value) +} + +/** + Add a constraint that requires that a key is equal to a `ParseObject`. + - parameter key: The key that the value is stored in. + - parameter value: The `ParseObject` to compare. + - parameter isUsingEQ: Set to **true** to use **$eq** comparater, + allowing for multiple `QueryConstraint`'s to be used on a single **key**. + Setting to *false* may override any `QueryConstraint`'s on the same **key**. + Defaults to `ParseSwift.configuration.isUsingEqualQueryConstraint`. + - returns: The same instance of `QueryConstraint` as the receiver. + - throws: An error of type `ParseError`. + - warning: `isUsingEQ == true` is known not to work for LiveQueries + on Parse Servers <= 5.0.0. + */ +public func equalTo (key: String, + value: T, + //swiftlint:disable:next line_length + isUsingEQ: Bool = ParseSwift.configuration.isUsingEqualQueryConstraint) throws -> QueryConstraint where T: ParseObject { + if !isUsingEQ { + return try QueryConstraint(key: key, value: value.toPointer()) + } else { + return try QueryConstraint(key: key, value: value.toPointer(), comparator: .equalTo) + } } /** @@ -703,7 +760,7 @@ public func isNull (key: String) -> QueryConstraint { - parameter key: The key that the value is stored in. - returns: The same instance of `QueryConstraint` as the receiver. */ -public func notNull (key: String) -> QueryConstraint { +public func isNotNull (key: String) -> QueryConstraint { QueryConstraint(key: key, comparator: .notEqualTo, isNull: true) } diff --git a/Tests/ParseSwiftTests/ParseQueryTests.swift b/Tests/ParseSwiftTests/ParseQueryTests.swift index bb9101ebd..5d6dd91ac 100644 --- a/Tests/ParseSwiftTests/ParseQueryTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryTests.swift @@ -62,6 +62,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length clientKey: "clientKey", masterKey: "masterKey", serverURL: url, + isUsingEqualQueryConstraint: false, testing: true) } @@ -1186,6 +1187,14 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(query.description, expected) } + func testWhereKeyEqualToBoolEQ() throws { + let query = GameScore.query(equalTo(key: "isCounts", value: true, isUsingEQ: true)) + // swiftlint:disable:next line_length + let expected = "GameScore ({\"limit\":100,\"skip\":0,\"_method\":\"GET\",\"where\":{\"isCounts\":{\"$eq\":true}}})" + XCTAssertEqual(query.debugDescription, expected) + XCTAssertEqual(query.description, expected) + } + func testWhereKeyEqualToParseObject() throws { var compareObject = GameScore(points: 11) compareObject.objectId = "hello" @@ -1195,6 +1204,15 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(query.debugDescription, expected) } + func testWhereKeyEqualToParseObjectEQ() throws { + var compareObject = GameScore(points: 11) + compareObject.objectId = "hello" + let query = try GameScore.query(equalTo(key: "yolo", value: compareObject, isUsingEQ: true)) + // swiftlint:disable:next line_length + let expected = "GameScore ({\"limit\":100,\"skip\":0,\"_method\":\"GET\",\"where\":{\"yolo\":{\"$eq\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}})" + XCTAssertEqual(query.debugDescription, expected) + } + func testWhereKeyEqualToParseObjectDuplicateConstraint() throws { var compareObject = GameScore(points: 11) compareObject.objectId = "hello" @@ -1235,7 +1253,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length func testWhereKeyNotNull() throws { var compareObject = GameScore(points: 11) compareObject.objectId = "hello" - let query = GameScore.query(notNull(key: "yolo")) + let query = GameScore.query(isNotNull(key: "yolo")) let expected = "GameScore ({\"limit\":100,\"skip\":0,\"_method\":\"GET\",\"where\":{\"yolo\":{\"$ne\":null}}})" XCTAssertEqual(query.debugDescription, expected) } From d9826930ec65135dfe3a56455f4c5a675909a32f Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 3 Jan 2022 01:17:24 -0500 Subject: [PATCH 2/9] nits --- CHANGELOG.md | 2 +- Sources/ParseSwift/Types/QueryConstraint.swift | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f211259b..116f2b018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ __New features__ - Adds withCount query ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds isNull and isNotNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). -- Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). +- Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#309](https://github.com/parse-community/Parse-Swift/pull/309)), thanks to [Corey Baker](https://github.com/cbaker6). __Improvements__ - Improve QueryWhere by making at a set of QueryConstraint's instead of any array. This dedupes the same constraint when encoding the query; improving the encoding speed when the same constraints are added ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). diff --git a/Sources/ParseSwift/Types/QueryConstraint.swift b/Sources/ParseSwift/Types/QueryConstraint.swift index 0055c7378..ad91a8243 100644 --- a/Sources/ParseSwift/Types/QueryConstraint.swift +++ b/Sources/ParseSwift/Types/QueryConstraint.swift @@ -7,7 +7,6 @@ // import Foundation -import UIKit /// Used to constrain a query. public struct QueryConstraint: Encodable, Hashable { From f2822545fcea57365ea941917912f9cb4c4c6116 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 3 Jan 2022 01:24:36 -0500 Subject: [PATCH 3/9] nit --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 116f2b018..50b74e2e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ __New features__ - Adds withCount query ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds isNull and isNotNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). -- Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#309](https://github.com/parse-community/Parse-Swift/pull/309)), thanks to [Corey Baker](https://github.com/cbaker6). +- Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#310](https://github.com/parse-community/Parse-Swift/pull/310)), thanks to [Corey Baker](https://github.com/cbaker6). __Improvements__ - Improve QueryWhere by making at a set of QueryConstraint's instead of any array. This dedupes the same constraint when encoding the query; improving the encoding speed when the same constraints are added ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). From 433b2ae12db556aadb8c354596a7430b7290316b Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 3 Jan 2022 11:47:18 -0500 Subject: [PATCH 4/9] Fix merge conflicts --- ParseSwift.playground/Sources/Common.swift | 16 +++++++++------- Sources/ParseSwift/Parse.swift | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/ParseSwift.playground/Sources/Common.swift b/ParseSwift.playground/Sources/Common.swift index ce8d88b82..95f2857c5 100644 --- a/ParseSwift.playground/Sources/Common.swift +++ b/ParseSwift.playground/Sources/Common.swift @@ -3,15 +3,17 @@ import ParseSwift public func initializeParse() { ParseSwift.initialize(applicationId: "applicationId", - clientKey: "clientKey", - masterKey: "masterKey", - serverURL: URL(string: "http://localhost:1337/1")!, - isUsingTransactions: false) + clientKey: "clientKey", + masterKey: "masterKey", + serverURL: URL(string: "http://localhost:1337/1")!, + isUsingTransactions: false, + isUsingEqualQueryConstraint: false) } public func initializeParseCustomObjectId() { ParseSwift.initialize(applicationId: "applicationId", - clientKey: "clientKey", - serverURL: URL(string: "http://localhost:1337/1")!, - isAllowingCustomObjectIds: true) + clientKey: "clientKey", + serverURL: URL(string: "http://localhost:1337/1")!, + isAllowingCustomObjectIds: true, + isUsingEqualQueryConstraint: false) } diff --git a/Sources/ParseSwift/Parse.swift b/Sources/ParseSwift/Parse.swift index fda953eb4..26fa006ae 100644 --- a/Sources/ParseSwift/Parse.swift +++ b/Sources/ParseSwift/Parse.swift @@ -115,6 +115,7 @@ public struct ParseConfiguration { isAllowingCustomObjectIds: Bool = false, isUsingTransactions: Bool = false, isUsingEqualQueryConstraint: Bool = false, + keyValueStore: ParseKeyValueStore? = nil, requestCachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, cacheMemoryCapacity: Int = 512_000, cacheDiskCapacity: Int = 10_000_000, @@ -279,6 +280,9 @@ public struct ParseSwift { keyValueStore: ParseKeyValueStore? = nil, requestCachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, cacheMemoryCapacity: Int = 512_000, + cacheDiskCapacity: Int = 10_000_000, + isMigratingFromObjcSDK: Bool = false, + isDeletingKeychainIfNeeded: Bool = false, httpAdditionalHeaders: [AnyHashable: Any]? = nil, maxConnectionAttempts: Int = 5, authentication: ((URLAuthenticationChallenge, @@ -299,6 +303,9 @@ public struct ParseSwift { cacheDiskCapacity: cacheDiskCapacity, isMigratingFromObjcSDK: isMigratingFromObjcSDK, isDeletingKeychainIfNeeded: isDeletingKeychainIfNeeded, + httpAdditionalHeaders: httpAdditionalHeaders, + maxConnectionAttempts: maxConnectionAttempts, + authentication: authentication)) } internal static func initialize(applicationId: String, @@ -320,14 +327,14 @@ public struct ParseSwift { isTesting: Bool = false, authentication: ((URLAuthenticationChallenge, (URLSession.AuthChallengeDisposition, - URLCredential?) -> Void) -> Void)? = nil) + URLCredential?) -> Void) -> Void)? = nil) { var configuration = ParseConfiguration(applicationId: applicationId, clientKey: clientKey, masterKey: masterKey, serverURL: serverURL, liveQueryServerURL: liveQueryServerURL, - allowCustomObjectId: allowCustomObjectId, - useTransactions: useTransactions, + isAllowingCustomObjectIds: isAllowingCustomObjectIds, + isUsingTransactions: isUsingTransactions, isUsingEqualQueryConstraint: isUsingEqualQueryConstraint, keyValueStore: keyValueStore, requestCachePolicy: requestCachePolicy, @@ -338,6 +345,9 @@ public struct ParseSwift { httpAdditionalHeaders: httpAdditionalHeaders, maxConnectionAttempts: maxConnectionAttempts, authentication: authentication) + configuration.isTestingSDK = isTesting + initialize(configuration: configuration) + } static internal func isDeletingKeychainIfNeeded() { #if !os(Linux) && !os(Android) && !os(Windows) From f74a0529ae82c95a3138d8bf910e10e61a92c1d5 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 3 Jan 2022 11:57:10 -0500 Subject: [PATCH 5/9] Update change log --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecad55976..66af1ce7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,11 @@ [Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.5.1...3.0.0) __New features__ +- Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#310](https://github.com/parse-community/Parse-Swift/pull/310)), thanks to [Corey Baker](https://github.com/cbaker6). +- Adds isNull and isNotNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). - (Breaking Change) Adds options to matchesText QueryConstraint along with the ability to see matching score. The compiler should recommend the new score property to all ParseObjects ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds withCount query ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). -- Adds isNull and isNotNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). -- Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#310](https://github.com/parse-community/Parse-Swift/pull/310)), thanks to [Corey Baker](https://github.com/cbaker6). __Improvements__ - (Breaking Change) Change boolean configuration parameters to match Swift conventions. The compilor should help with name changes ([#311](https://github.com/parse-community/Parse-Swift/pull/311)), thanks to [Corey Baker](https://github.com/cbaker6). From 8b7f2c5ff55606382511f6d8775d5cf1a24544eb Mon Sep 17 00:00:00 2001 From: Corey Date: Mon, 3 Jan 2022 12:16:53 -0500 Subject: [PATCH 6/9] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66af1ce7c..ae46aa8ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,9 @@ __New features__ - Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#310](https://github.com/parse-community/Parse-Swift/pull/310)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds isNull and isNotNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). +- - Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). - (Breaking Change) Adds options to matchesText QueryConstraint along with the ability to see matching score. The compiler should recommend the new score property to all ParseObjects ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds withCount query ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). -- Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). __Improvements__ - (Breaking Change) Change boolean configuration parameters to match Swift conventions. The compilor should help with name changes ([#311](https://github.com/parse-community/Parse-Swift/pull/311)), thanks to [Corey Baker](https://github.com/cbaker6). From 71f12f608252202248a4e2d9462c485c41cad882 Mon Sep 17 00:00:00 2001 From: Corey Date: Mon, 3 Jan 2022 12:23:00 -0500 Subject: [PATCH 7/9] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae46aa8ac..f8f01783f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ __New features__ - Adds equalTo QueryConstraint along with ability to change the SDK default behavior of using $eq QueryConstraint parameter or not ([#310](https://github.com/parse-community/Parse-Swift/pull/310)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds isNull and isNotNull QueryConstraint along with the ability set/forceSet null using ParseOperation ([#308](https://github.com/parse-community/Parse-Swift/pull/308)), thanks to [Corey Baker](https://github.com/cbaker6). -- - Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). +- Adds auth support for GitHub, Google, and LinkedIn ([#307](https://github.com/parse-community/Parse-Swift/pull/307)), thanks to [Corey Baker](https://github.com/cbaker6). - (Breaking Change) Adds options to matchesText QueryConstraint along with the ability to see matching score. The compiler should recommend the new score property to all ParseObjects ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). - Adds withCount query ([#306](https://github.com/parse-community/Parse-Swift/pull/306)), thanks to [Corey Baker](https://github.com/cbaker6). From 81ac7dd686559e3ee962f898d31ecf7b6df3ed43 Mon Sep 17 00:00:00 2001 From: Corey Date: Mon, 3 Jan 2022 12:29:06 -0500 Subject: [PATCH 8/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ddb69e133..f8a934ab7 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ let package = Package( Then run `swift build`. You can also install using SPM in your Xcode project by going to -"Project->NameOfYourProject->Swift Packages" and placing "https://github.com/parse-community/Parse-Swift.git" in the +"Project->NameOfYourProject->Swift Packages" and placing `https://github.com/parse-community/Parse-Swift.git` in the search field. ### [CocoaPods](https://cocoapods.org) From 4f10f39fed209bd06269b6ea75843e80e5d120d3 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 3 Jan 2022 12:42:33 -0500 Subject: [PATCH 9/9] nits --- .../Pages/13 - Operations.xcplaygroundpage/Contents.swift | 2 +- .../Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift | 2 +- Sources/ParseSwift/Parse.swift | 3 ++- Sources/ParseSwift/Types/QueryConstraint.swift | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift index 96708e2e9..16689aed5 100644 --- a/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/13 - Operations.xcplaygroundpage/Contents.swift @@ -72,7 +72,7 @@ do { print(error) } -//: Query all scores whose is null or undefined. +//: Query all scores whose name is null or undefined. let query1 = GameScore.query(isNotNull(key: "name")) let results1 = try query1.find() print("Total found: \(results1.count)") diff --git a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift index 67b4cc543..c2ceb9753 100644 --- a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift @@ -191,7 +191,7 @@ query4.find { results in } } -//: Get the same results as the previous query whose location is not null or undefined. +//: If you want to query for points > 9 and whose location is not null or undefined. var anotherQuery4 = GameScore.query("points" > 9, isNotNull(key: "location")) anotherQuery4.find { results in switch results { diff --git a/Sources/ParseSwift/Parse.swift b/Sources/ParseSwift/Parse.swift index 26fa006ae..7945fba1d 100644 --- a/Sources/ParseSwift/Parse.swift +++ b/Sources/ParseSwift/Parse.swift @@ -31,7 +31,7 @@ public struct ParseConfiguration { public internal(set) var isUsingTransactions = false /// Use the **$eq** query constraint when querying. - /// - warning: This is known not to work for LiveQueries on Parse Servers < 5.0.0. + /// - warning: This is known not to work for LiveQuery on Parse Servers <= 5.0.0. public internal(set) var isUsingEqualQueryConstraint = false /// The default caching policy for all http requests that determines when to @@ -249,6 +249,7 @@ public struct ParseSwift { - parameter keyValueStore: A key/value store that conforms to the `ParseKeyValueStore` protocol. Defaults to `nil` in which one will be created an memory, but never persisted. For Linux, this this is the only store available since there is no Keychain. Linux users should replace this store with an + encrypted one. - parameter requestCachePolicy: The default caching policy for all http requests that determines when to return a response from the cache. Defaults to `useProtocolCachePolicy`. See Apple's [documentation](https://developer.apple.com/documentation/foundation/url_loading_system/accessing_cached_data) for more info. diff --git a/Sources/ParseSwift/Types/QueryConstraint.swift b/Sources/ParseSwift/Types/QueryConstraint.swift index ad91a8243..1cbf56c2d 100644 --- a/Sources/ParseSwift/Types/QueryConstraint.swift +++ b/Sources/ParseSwift/Types/QueryConstraint.swift @@ -139,7 +139,7 @@ public func <= (key: String, value: T) -> QueryConstraint where T: Encodable - returns: The same instance of `QueryConstraint` as the receiver. - warning: See `equalTo` for more information. Behavior changes based on `ParseSwift.configuration.isUsingEqualQueryConstraint` - where isUsingEqualQueryConstraint == true is known not to work for LiveQueries on + where isUsingEqualQueryConstraint == true is known not to work for LiveQuery on Parse Servers <= 5.0.0. */ public func == (key: String, value: T) -> QueryConstraint where T: Encodable { @@ -177,7 +177,7 @@ public func equalTo (key: String, - throws: An error of type `ParseError`. - warning: See `equalTo` for more information. Behavior changes based on `ParseSwift.configuration.isUsingEqualQueryConstraint` - where isUsingEqualQueryConstraint == true is known not to work for LiveQueries on + where isUsingEqualQueryConstraint == true is known not to work for LiveQuery on Parse Servers <= 5.0.0. */ public func == (key: String, value: T) throws -> QueryConstraint where T: ParseObject {