I have a Json type column in MySql and I am using Scala with Slick.
How can I Provide support for the Json Column via Slick.
class SampleTable(tag: Tag) extends Table[(String, ??)](tag, "test") {
override def * : ProvenShape[NodeReference] = (name, data)
def name: Rep[String] = column[String]("name", O.PrimaryKey)
def Data: Rep[??] = column[??]("data", O.PrimaryKey)
}
Any Help will be appreciated. Thanks In Advance
You can use a
BaseColumnTypeto convert yourJSONto a String while writing it to the database and parsing it toJSONwhile reading from the database: