Pattern matching on Stream, Option and creating a Tuple
问题 I have a table table1 : id: Int externalId: Int value: String For a given externalId value can be NULL or it might not exist at all. I want to return a tuple depending on this condition: If it doesn't exist then return ("notExists", Nil) If it exists but NULL then return ("existsButNull", Nil) If it exists and not NULL then return ("existsWithValue", ???) where ??? should be a list of value for all records with the given externalId . I tried to do this: DB.withConnection { implicit c => SQL(