Trying to understand the following syntax (the implicit session) in Scala:
def getDates(date: String): Option[String] = DB.readOnly { implicit session =>
val date = "20201020"
}
Using the readOnly method from scalalikejdbc. Definition of method is:
def readOnly[A](execution: DBSession => A)(implicit context: CPContext = NoCPContext, settings: SettingsProvider = SettingsProvider.default): A = {
val cp = connectionPool(context)
using(cp.borrow()) { conn =>
DB(conn, cp.connectionAttributes, settings).autoClose(false).readOnly(execution)
}
}