Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make QuerySubject.path public for use in custom operators #326

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Sources/Meow/KeyPathModel/KeyPathModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct QueryMatcher<M: KeyPathQueryable> {

public subscript<T: Codable>(dynamicMember keyPath: KeyPath<M, QueryableField<T>>) -> QuerySubject<M, T> {
let path = M.resolveFieldPath(keyPath)
return QuerySubject(path: FieldPath(components: path))
return QuerySubject(_path: FieldPath(components: path))
}
}

Expand All @@ -22,11 +22,12 @@ public struct QueryMatcher<M: KeyPathQueryable> {
/// Used to construct type-checked queries
@dynamicMemberLookup
public struct QuerySubject<M: KeyPathQueryable, T: Codable> {
internal let path: FieldPath!
internal let _path: FieldPath!
public var path: FieldPath { _path }

public subscript<New>(dynamicMember keyPath: KeyPath<T, QueryableField<New>>) -> QuerySubject<M, New> where T: KeyPathQueryable {
let path = T.resolveFieldPath(keyPath)
return QuerySubject<M, New>(path: FieldPath(components: self.path.components + path))
return QuerySubject<M, New>(_path: FieldPath(components: self.path.components + path))
}
}

Expand Down