-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Description
Description
If a column is defined as optional string, the like operator cannot be used
Checklist
- I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
- If possible, I've reproduced the issue using the
mainbranch of this package. - This issue hasn't been addressed in an existing GitHub issue or discussion.
Expected behavior
A snippet like the following should compile
@Table
struct Tab: Sendable {
let id: Int
let name: String?
}
struct Foo:View {
@FetchAll(
Tab.all
.where {
$0.name.like("%test%")
}
.select {
$0.id
}
)
var tabs
var body: some View { EmptyView() }
}
Actual behavior
the operator like is defined to have a QueryExpression as LHS generic, and the sugarcoted like function is defined only on this extension
extension QueryExpression where QueryValue == String {
Normally for a operator to be available for column with a Wrapped optional it should be defined in another extension additionally to the not optional one
It is a perfectly valid QUERY string to provide a not "String" expression as LHS part of a LIKE operator, so the LHS requirement may be dropped, and other swift extension function may be provided
Reproducing project
No response
Structured Queries version information
0.21
Destination operating system
No response
Xcode version information
No response
Swift Compiler version information
Metadata
Metadata
Assignees
Labels
No labels