zio/zio-sql

Unable to run example code

Closed this issue · 2 comments

Apologies for posting this here but could not find other forms available for this discussion. I'm unable to run the example code. I get an error "No implicits found for parameter schema: Schema.Record[Person]" for the defineTable() method. I've copied the code example as shown. Does this mean that zio.schema isnt generating the appropriate code for me? Thank you for your help

import zio.schema.Schema
import zio.sql.postgresql.PostgresJdbcModule

object playground extends PostgresJdbcModule {

  final case class Person(name: String, age: Int)
  implicit val schema: Schema[Person] = DeriveSchema.gen[Person]

  val person = defineTable[Person]. // error is here

}

hi @davidleacock try to remove Schema[Person[ type and let compiler infer value for you.
So:

  implicit val schema = DeriveSchema.gen[Person]

Let me know if that helps

Thank you for your response. I apologize, this appears to be an issue with IntelliJ. I'm able to command line compile and access the person table but the error still shows so its a problem with the IDE. Closing the issue.