Replies: 3 comments 2 replies
-
If the LHS String requirement is to be dropped, I already have an extension that may work
|
Beta Was this translation helpful? Give feedback.
-
I've seen this PR , #80 , I think that then this is not a bug, but something that is designed this way? But honestly I don't understand why map/flatMap should be more ergonomic than directly calling a "like function" |
Beta Was this translation helpful? Give feedback.
-
@Playrom While $0.name.map { $0.like("%test%") } You could also coalesce to an empty string: ($0.name ?? "").like("%test%") Since this isn't a bug I'm going to convert to a discussion. Let us know what you think! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
If a column is defined as optional string, the like operator cannot be used
Checklist
main
branch of this package.Expected behavior
A snippet like the following should compile
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
Beta Was this translation helpful? Give feedback.
All reactions