Skip to content

Commit

Permalink
remove attributeExists operation from QueryFieldOperation
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed Mar 14, 2024
1 parent 21b5f20 commit 5e083a1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
5 changes: 0 additions & 5 deletions Amplify/Categories/DataStore/Query/ModelKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ public protocol ModelKey: CodingKey, CaseIterable, QueryFieldOperation {}

extension CodingKey where Self: ModelKey {

// MARK: - attributeExists
public func attributeExists(_ value: Bool) -> QueryPredicateOperation {
return field(stringValue).attributeExists(value)
}

// MARK: - beginsWith
public func beginsWith(_ value: String) -> QueryPredicateOperation {
return field(stringValue).beginsWith(value)
Expand Down
7 changes: 0 additions & 7 deletions Amplify/Categories/DataStore/Query/QueryField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public func field(_ name: String) -> QueryField {
/// - seealso: `ModelKey`
public protocol QueryFieldOperation {
// MARK: - Functions
func attributeExists(_ value: Bool) -> QueryPredicateOperation
func beginsWith(_ value: String) -> QueryPredicateOperation
func between(start: Persistable, end: Persistable) -> QueryPredicateOperation
func contains(_ value: String) -> QueryPredicateOperation
Expand Down Expand Up @@ -61,11 +60,6 @@ public struct QueryField: QueryFieldOperation {

public let name: String

// MARK: - attributeExists
public func attributeExists(_ value: Bool) -> QueryPredicateOperation {
return .operation(name, .attributeExists(value))
}

// MARK: - beginsWith
public func beginsWith(_ value: String) -> QueryPredicateOperation {
return .operation(name, .beginsWith(value))
Expand Down Expand Up @@ -167,7 +161,6 @@ public struct QueryField: QueryFieldOperation {
.operation(name, .notEqual(value))
])
}

}

public func ne(_ value: EnumPersistable) -> QueryPredicateOperation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class GraphQLListQueryTests: XCTestCase {
func test_listQuery_withAttributeExistsFilter_correctlyBuildGraphQLQueryStatement() {
let post = Post.keys
let predicate = post.id.eq("id")
&& (post.draft.attributeExists(false) || post.draft.eq("null"))
&& post.draft.eq(nil)

var documentBuilder = ModelBasedGraphQLDocumentBuilder(modelSchema: Post.schema, operationType: .query)
documentBuilder.add(decorator: DirectiveNameDecorator(type: .list))
Expand Down Expand Up @@ -292,7 +292,7 @@ class GraphQLListQueryTests: XCTestCase {
},
{
"draft" : {
"eq" : "null"
"eq" : null
}
}
]
Expand Down

0 comments on commit 5e083a1

Please sign in to comment.