zio-cassandra
scala = 2.13.6
cassandra-driver = 4.13.0
zio = 1.0.12
Inspired by akka/alpakka-cassandra
Usage
Dependency:
libraryDependencies += "io.github.jsfwa" %% "zio-cassandra" % "1.0.6"
Check driver config documentation on datastax
// Cassandra Session:
val session = CassandraSession.make(config)
//OR
val session = CassandraSession.make(cqlSessionBuilder)
// Use:
val job = for {
session <- ZIO.service[CassandraSession]
_ <- session.execute("insert ...")
prepared <- session.prepare("select ...")
select <- session.bind(prepared, Seq(args))
row <- session.selectOne(select, profileName = "oltp")
} yield row
job.provideCustomLayer(CassandraSession.make(config).toLayer)