PgPlayJsonSupport
and PlayJsonImplicits
as shown in several examples but the traits are no longer available using import com.github.tminglei.slickpg._
. I am using the version "com.github.tminglei" %% "slick-pg" % "0.16.0"
. Do any of you know if they have been removed ?
Hi, I have this code:
package postg
import spatutorial.shared._
import scala.concurrent.Future
import javax.inject.Inject
import play.api.db.slick.DatabaseConfigProvider
import play.api.db.slick.HasDatabaseConfigProvider
import scala.concurrent.ExecutionContext.Implicits.global
import MySlickPg.MyPostgresProfile.api._
class CPreciosPg {
private class tabla(tag: Tag) extends Table[Precios](tag, "tblofic") {
def id_comparativo = column[String]("id_comparativo")
def rfc = column[String]("rfc")
def cve_articulo = column[String]("cve_articulo")
def renglon = column[Int]("renglon")
def precio = column[Double]("precio")
def marca = column[Option[String]]("marca")
def anexo = column[Option[String]]("anexo")
def modelo = column[Option[String]]("modelo")
def descalificado = column[Boolean]("descalificado")
def gana = column[Option[Boolean]]("gana")
def * = (id_comparativo, rfc, cve_articulo, renglon, precio, marca, anexo, modelo, descalificado, gana) <> (Precios.tupled, Precios.unapply)
}
def ById() = {
val query = TableQuery(new tabla(_))
val v = for {
q <- query
} yield q
v.map(println)
"nada"
}
}
But I only get this:
[warn] M.MyPostgresProfile - >>> DUPLICATED binding for tsrange - existed: com.github.tminglei.slickpg.Range, new: com.github.tminglei.slickpg.Range !!! If it's expected, pls ignore it.
[warn] M.MyPostgresProfile - >>> DUPLICATED binding for daterange - existed: com.github.tminglei.slickpg.Range, new: com.github.tminglei.slickpg.Range !!! If it's expected, pls ignore it.
Rep(Ref @1094116140)
Someone could tell me, Why happen this?
Now I have this code:
package postg
import spatutorial.shared._
import scala.concurrent.Future
import javax.inject.Inject
import play.api.db.slick.DatabaseConfigProvider
import play.api.db.slick.HasDatabaseConfigProvider
import scala.concurrent.ExecutionContext.Implicits.global
//import play.api.db.slick.Profile._
//import profile.simple._
import slick.jdbc.JdbcProfile
import play.api.db.slick.DatabaseConfigProvider
import play.api.db.slick.HasDatabaseConfigProvider
import play.db.NamedDatabase
import MySlickPg.MyPostgresProfile.api._
class CPreciosPg @Inject()( @NamedDatabase("sicap")
protected val dbConfigProvider: DatabaseConfigProvider,
protected val provCotizan: CProvCotizan
) extends HasDatabaseConfigProvider[JdbcProfile]{
import profile.api._
private class tabla(tag: Tag) extends Table[ProvCotizan](tag, "proveedores") {
def id_comparativo = column[String]("id_comparativo")
def rfc = column[String]("rfc")
def plazo = column[String]("plazo")
def pago = column[String]("pago")
def garantia = column[String]("garantia")
def todo = column[Boolean]("todo")
def descalificado = column[Boolean]("descalificado")
def * = (id_comparativo, rfc, plazo, pago, garantia, todo, descalificado) <> (ProvCotizan.tupled, ProvCotizan.unapply)
}
def ById() = {
val query = TableQuery(new tabla(_))
val v = for {
q <- query
} yield {
}
v.map(println)
"nada"
}
}
but I have this result:
()
`def @>[P2,R](c2: Rep[P2])(implicit om: o#arg[JSONType, P2]#to[Boolean, R]) = {
om.column(jsonLib.Contains, n, c2.toNode)
}`
.filter({ case (_, pr) => pr.predicate @> Json.parse(s"""{"userRole":["$userRole"]}""")})
Hi,
I was wondering if something like this is possible using json helpers:
dbConfig.db.run(myTable.filter(_.state.~>("finished") === true).result.headOption)
Where state
is a JSON field on the table having a finished
attribute which is boolean.
However the compiler is complaining:
[error] ... Cannot perform option-mapped operation
[error] with type: (io.circe.Json, Boolean) => R
[error] for base type: (io.circe.Json, io.circe.Json) => Boolean
[error] dbConfig.db.run(myTable.filter(_.state.+>("finished") === true).result.headOption)
[error] ^
[error] ... ambiguous implicit values:
[error] both value BooleanCanBeQueryCondition in object CanBeQueryCondition of type => slick.lifted.CanBeQueryCondition[Boolean]
[error] and value BooleanColumnCanBeQueryCondition in object CanBeQueryCondition of type => slick.lifted.CanBeQueryCondition[slick.lifted.Rep[Boolean]]
[error] match expected type slick.lifted.CanBeQueryCondition[Nothing]
[error] dbConfig.db.run(myTable.filter(_.state.+>("finished") === true).result.headOption)
[error] ^
implicit private val instantColumn: JdbcType[java.time.Instant] = MappedColumnType.base[java.time.Instant, java.sql.Timestamp](
instant => java.sql.Timestamp.from(instant),
column => column.toInstant)
could not find implicit value for parameter tt: slick.ast.TypedType[Option[com.vividsolutions.jts.geom.Geometry]]
. I have defined my postgres profile as given at https://github.com/tminglei/slick-pg. Am I missing something here?
com.vividsolutions.jts.geom.Geometry
with String
, the error goes away.
I have used codegen with slick pg. The generated code throws
could not find implicit value for parameter tt: slick.ast.TypedType[Option[com.vividsolutions.jts.geom.Geometry]]
. I have defined my postgres profile as given at https://github.com/tminglei/slick-pg. Am I missing something here?
Any suggestion on that?
select last_name,
first_name,
(select string_agg(medical_specialty.name, '; ') from medical_specialty join doctor_medical_specialty dms on medical_specialty.id = dms.medical_specialty where dms.doctor = doctor.id) as specialties,
(select string_agg(medical_subspecialty.name, '; ') from medical_subspecialty join doctor_medical_subspecialty dms on medical_subspecialty.id = dms.medical_subspecialty where dms.doctor = doctor.id) as subspecialties,
cell_number,
email_address,
rating,
(select string_agg(hospital.name, '; ') from hospital join doctor_hospital dh on hospital.id = dh.hospital where dh.doctor = doctor.id) as hospitals,
(select string_agg(o.name, '; ') from doctoroffice o where o.doctor = doctor.id) as offices
from doctor
Doctors
.map { doc =>
val specialties =
ManageDoctorsDbActions.specialtiesQuery.filter(_._1 === doc.lookup).map(t => stringAgg(t._2.name, "; "))
(doc, specialties)
}
Doctors
.map { doc =>
val specialties =
stringAgg(ManageDoctorsDbActions.specialtiesQuery.filter(_._1 === doc.lookup).map(t => t._2.name), "; ")
(doc, specialties)
}