io.getquill.context.qzio
package io.getquill.context.qzio
Members list
Type members
Classlikes
object ImplicitSyntax
Use to provide run(myQuery)
calls with a context implicitly saving the need to provide things multiple times. For example in JDBC:
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 with Closeable) {
import Ctx._
implicit val env = Implicit(Has(ds))
val joes = Ctx.run(query[Person].filter(p => p.name == "Joe")).onDataSource.implicitly
val jills = Ctx.run(query[Person].filter(p => p.name == "Jill")).onDataSource.implicitly
val alexes = Ctx.run(query[Person].filter(p => p.name == "Alex")).onDataSource.implicitly
}
Normally you would have to do a separate provide
for each clause:
val joes = Ctx.run(query[Person].filter(p => p.name == "Joe")).onDataSource.provide(Has(ds))
val jills = Ctx.run(query[Person].filter(p => p.name == "Jill")).onDataSource.provide(Has(ds))
val alexes = Ctx.run(query[Person].filter(p => p.name == "Alex")).onDataSource.provide(Has(ds))
For other contexts where the environment returned from run(myQuery)
just the session itself, usage is even simpler. For instance, in quill-zio-cassandra, you only need to specify implicitly
.
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
}
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ImplicitSyntax.type
trait ZioContext[+Idiom <: Idiom, +Naming <: NamingStrategy] extends Context[Idiom, Naming], ContextVerbStream[Idiom, Naming]
Attributes
- Supertypes
-
trait ContextVerbStream[Idiom, Naming]trait ProtoStreamContext[Idiom, Naming]trait Context[Idiom, Naming]trait Closeabletrait AutoCloseabletrait EncodingDsltrait LowPriorityImplicitstrait ProtoContextSecundus[Idiom, Naming]trait RowContextclass Objecttrait Matchableclass AnyShow all
trait ZioTranslateContext[+Dialect <: Idiom, +Naming <: NamingStrategy] extends Context[Dialect, Naming], ContextTranslateMacro[Dialect, Naming]
Attributes
- Supertypes
-
trait ContextTranslateMacro[Dialect, Naming]trait ContextTranslateProto[Dialect, Naming]trait Context[Dialect, Naming]trait Closeabletrait AutoCloseabletrait EncodingDsltrait LowPriorityImplicitstrait ProtoContextSecundus[Dialect, Naming]trait RowContextclass Objecttrait Matchableclass AnyShow all
In this article