@dryv/slick-tablesv0.1.0
Profile-neutral Slick table-support traits with keys, indexes and relations.
dryv pack add @dryv/slick-tablespackage {{ pack.inputs.root_package }}
import io.circe.Json
import io.circe.parser
import slick.jdbc.JdbcProfile
trait DryvProfile:
val profile: JdbcProfile
import profile.api.*
given BaseColumnType[Json] =
MappedColumnType.base[Json, String](
_.noSpaces,
raw =>
parser.parse(raw).fold(
error => throw new IllegalArgumentException("Invalid JSON database value: " + error),
identity,
),
)