ImplicitSyntax

io.getquill.context.qzio.ImplicitSyntax

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

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

final case class Implicit[R](env: R)

A new type that indicates that the value R should be made available to the environment implicitly.

A new type that indicates that the value R should be made available to the environment implicitly.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final implicit class ImplicitSyntaxOps[R, E, A](self: ZIO[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final implicit class StreamImplicitSyntaxOps[R, E, A](self: ZStream[R, E, A]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Implicits

Implicits

final implicit def ImplicitSyntaxOps[R, E, A](self: ZIO[R, E, A]): ImplicitSyntaxOps[R, E, A]
final implicit def StreamImplicitSyntaxOps[R, E, A](self: ZStream[R, E, A]): StreamImplicitSyntaxOps[R, E, A]