To access our database, we need to define the schema for Slick to perform queries against the database and wrap everything in a data access class.
The ProductsDao class is as follows:
class ProductsDao @Inject()(protected val dbConfigProvider: DatabaseConfigProvider)(implicit executionContext: ExecutionContext) extends HasDatabaseConfigProvider[JdbcProfile] { import profile.api._ def all(): Future[Seq[Product]] = db.run(products.result) def insert(product: Product): Future[Unit] = db.run(products insertOrUpdate product).map { _ => () } private class ProductsTable(tag: Tag) extends Table[Product](tag, "PRODUCTS") { def name = column[String]("NAME") def code = column[String]("CODE") def description = column[String]("DESCRIPTION") ...