Package

io.getquill.context

qzio

Permalink

package qzio

Visibility
  1. Public
  2. All

Type Members

  1. trait ZioContext[Idiom <: Idiom, Naming <: NamingStrategy] extends Context[Idiom, Naming] with StreamingContext[Idiom, Naming]

    Permalink
  2. trait ZioTranslateContext extends TranslateContextBase

    Permalink

Value Members

  1. object ImplicitSyntax

    Permalink

    Use to provide run(myQuery) calls with a context implicitly saving the need to provide things multiple times.

    Use to provide run(myQuery) calls with a context implicitly saving the need to provide things multiple times. For example in JDBC:

    case class MyQueryService(ds: DataSource) {
      import Ctx._
      implicit val env = Implicit(Has(ds))
    
      val joes = Ctx.run(query[Person].filter(p => p.name == "Joe")).implicitly
      val jills = Ctx.run(query[Person].filter(p => p.name == "Jill")).implicitly
      val alexes = Ctx.run(query[Person].filter(p => p.name == "Alex")).implicitly
    }

    Normally you would have to do a separate provide for each clause:

    val joes = Ctx.run(query[Person].filter(p => p.name == "Joe")).provide(Has(ds))
    val jills = Ctx.run(query[Person].filter(p => p.name == "Jill")).provide(Has(ds))
    val alexes = Ctx.run(query[Person].filter(p => p.name == "Alex")).provide(Has(ds))

    For other contexts e.g. Cassandra the functionality is identical.

    case class MyQueryService(cs: CassandraZioSession) {
      import Ctx._
      implicit val env = Implicit(Has(cs))
    
      def joes = Ctx.run { query[Person].filter(p => p.name == "Joe") }.implicitly
      def jills = Ctx.run { query[Person].filter(p => p.name == "Jill") }.implicitly
      def alexes = Ctx.run { query[Person].filter(p => p.name == "Alex") }.implicitly
    }

Ungrouped