Slick PostgreSQL List
trait MyPostgresProfile | |
extends ExPostgresProfile | |
with PgArraySupport | |
with PgDate2Support | |
with PgRangeSupport | |
with PgHStoreSupport { | |
def pgjson = "jsonb" | |
// Add back `capabilities.insertOrUpdate` to enable native `upsert` support; for postgres 9.5+ | |
override protected def computeCapabilities: Set[Capability] = | |
super.computeCapabilities + slick.jdbc.JdbcCapabilities.insertOrUpdate | |
override val api = MyAPI | |
object MyAPI extends API with ArrayImplicits with DateTimeImplicits with RangeImplicits with HStoreImplicits { | |
val strSimpleJdbcArrayListType: SimpleArrayJdbcType[String] = new SimpleArrayJdbcType[String]("text") | |
implicit val strListTypeMapper: JdbcType[List[String]] = | |
strSimpleJdbcArrayListType.to(_.toList) | |
// here we | |
implicit val useCaseListTypeMapper: JdbcType[List[UseCase]] = strSimpleJdbcArrayListType | |
.mapTo[UseCase](str => UseCase.of(str), uc => uc.label) | |
.to(_.toList) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment