jsfwa / zio-cassandra   2.2.1

Apache License 2.0 GitHub

Just alternative wrapper for zio, inspired by akka(alpakka)-cassandra

Scala versions: 3.x 2.13

Release Artifacts Snapshot Artifacts

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)