Type 'UUID' does not conform to protocol 'QueryExpression' #45
-
Couldn't find any documentation on how to add conformance to UUID so I can do these types of calls:
where Workout is defined as such:
Is there a work-around for this? If I have to add my own conformance, how would I do that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
@whoyawn To use the query builder with one of these types they must be explicitly bound so that we know what to represent the UUID as. This can be done using let query = Workout
- .where { $0.id.eq(workout.id) }
+ .where { $0.id.eq(#bind(workout.id)) }
.fetchAll(db) I've PR'd #46 to add this info to the docs @bradhowes linked to. We also have #37, which we will likely merge in the future, to make these operations simpler when using a default representation. In this case, lowercased will probably be the default UUID representation, so you would be able to remove the |
Beta Was this translation helpful? Give feedback.
@whoyawn To use the query builder with one of these types they must be explicitly bound so that we know what to represent the UUID as. This can be done using
#bind
.I've PR'd #46 to add this info to the docs @bradhowes linked to.
We also have #37, which we will likely merge in the future, to make these operations simpler when using a default representation. In this case, lowercased will probably be the default UUID representation, so you would be able to remove the
@Column(as:)
and#bind
whenever we release that functionality.