Created
March 26, 2014 15:16
-
-
Save Pyppe/9785721 to your computer and use it in GitHub Desktop.
Slick 2.0.1: How to map from Set[String] to Option[String]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit val SetOfStrings = MappedColumnType.base[Set[String], Option[String]] ( | |
values => values match { | |
case values if values.nonEmpty => Some(values.toSeq.sorted.mkString("\n")) | |
case _ => None | |
}, | |
str => str.map(_.split('\n').toSet).getOrElse(Set.empty) | |
) | |
// could not find implicit value for evidence parameter of type SchemaBase.this.driver.BaseColumnType[Option[String]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment