Skip to content

Instantly share code, notes, and snippets.

@dacc
Created February 28, 2013 07:10
Show Gist options
  • Save dacc/5054859 to your computer and use it in GitHub Desktop.
Save dacc/5054859 to your computer and use it in GitHub Desktop.
def mkArrayRep(list: List[String]): String =
list.map(_.replace("\"", "\\\"").replace("\\", "\\\\"))
.mkString("{\"", "\", \"", "\"}")
def mkList(string: String): List[String] = {
val commaSeparated = string.substring(1, string.length - 1)
StringUtil.parseCsvLine(commaSeparated).toList
}
implicit def stringArrayMapper = MappedTypeMapper.base[List[String], String](mkArrayRep _, mkList _)
def someCol = column[List[String]]("some_col", O.DBType("text[]"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment