CassandraZioContext

class CassandraZioContext[N <: NamingStrategy](val naming: N) extends CassandraStandardContext[N] with ZioContext[CqlIdiom, N] with Context[CqlIdiom, N] with CioOps

Quill context that executes Cassandra queries inside of ZIO. Unlike most other contexts that require passing in a Data Source, this context takes in a ZioCassandraSession as a resource dependency which can be provided later (see the ZioCassandraSession object for helper methods that assist in doing this).

The resource dependency itself is just a Has[ZioCassandraSession]

Various methods in the io.getquill.ZioCassandraSession can assist in simplifying it's creation, for example, you can provide a Config object instead of a ZioCassandraSession like this (note that the resulting ZioCassandraSession has a closing bracket). {{ val zioSession = ZioCassandraSession.fromPrefix("testStreamDB") }}

If you are using a Plain Scala app however, you will need to manually run it e.g. using zio.Runtime {{ Runtime.default.unsafeRun(MyZioContext.run(query[Person]).provideCustomLayer(zioSession)) }}

ProtoQuill Note: Zio Cassandra context does not implement prepare. This it can extend StandardContext in Scala2-Quill because presence of prepare___ methods is not enforced. Due to stricter type requirements in Dotty however, this is not allowed here.

Companion
object
trait CioOps
trait ZioContext[CqlIdiom, N]
trait ContextVerbStream[CqlIdiom, N]
trait ProtoStreamContext[CqlIdiom, N]
trait CassandraStandardContext[N]
trait Decoders
trait UdtDecoding
trait CollectionDecoders
trait Encoders
trait UdtEncoding
trait CollectionEncoders
trait CassandraContext[N]
trait Encodings
trait CassandraTypes
trait CassandraMappedTypes
trait CassandraMapperConversions
trait CassandraMapperConversionsLowPriorityImplicits
trait Context[CqlIdiom, N]
trait Closeable
trait AutoCloseable
trait EncodingDsl
trait LowPriorityImplicits
trait ProtoContext[CqlIdiom, N]
trait CassandraRowContext
trait RowContext
class Object
trait Matchable
class Any

Type members

Inherited classlikes

case
class BatchGroup(string: String, prepare: List[Prepare])
Inherited from
RowContext
case
class BatchGroupReturning(string: String, returningBehavior: ReturnAction, prepare: List[Prepare])
Inherited from
RowContext
case
class CassandraDecoder[T](decoder: () => T)
Inherited from
Decoders
case
class CassandraEncoder[T](encoder: () => T)
Inherited from
Encoders
implicit
class CioExt[T](cio: CIO[T])
Inherited from
CioOps
Inherited from
Context

Types

override
override
type Error = Throwable
override
type PrepareRow = BoundStatement
override
type Result[T] = CIO[T]
override
type ResultRow = Row
override
type RunActionResult = Unit
override
override
type RunQueryResult[T] = List[T]
override
override
type Runner = Unit
override
type StreamResult[T] = CStream[T]

Inherited types

type BaseDecoder[T] = GenericDecoder[ResultRow, Session, T, Specific]
Inherited from
EncodingDsl
type BaseEncoder[T] = GenericEncoder[T, PrepareRow, Session]
Inherited from
EncodingDsl
type ColumnResolver = GenericColumnResolver[ResultRow]
Inherited from
EncodingDsl
Inherited from
Decoders
type DecoderMethod[T] = (Int, ResultRow, Session) => T
Inherited from
EncodingDsl
Inherited from
Encoders
type EncoderMethod[T] = (Int, T, PrepareRow, Session) => PrepareRow
Inherited from
EncodingDsl
type Extractor[T] = (ResultRow, Session) => T
Inherited from
RowContext
type Prepare = (PrepareRow, Session) => (List[Any], PrepareRow)
Inherited from
RowContext
type RowTyper[T] = GenericRowTyper[ResultRow, T]
Inherited from
EncodingDsl
override
Inherited from
CassandraStandardContext
override
Inherited from
CassandraStandardContext
type RunnerBehavior <: RunnerSummoningBehavior

Base type used to determine whether there is an execution context that needs to be summoned to perform execution methods e.g. in the PostgresJasync contexts that use Scala Futures that need an ExecutionContext.

Base type used to determine whether there is an execution context that needs to be summoned to perform execution methods e.g. in the PostgresJasync contexts that use Scala Futures that need an ExecutionContext.

Inherited from
Context

Value members

Concrete methods

override
def close(): Unit
Definition Classes
Context -> Closeable -> AutoCloseable
def executeAction(cql: String, prepare: Prepare)(info: ExecutionInfo, dc: Runner): CIO[Unit]
def executeBatchAction(groups: List[BatchGroup])(info: ExecutionInfo, dc: Runner): CIO[Unit]
def executeQuery[T](cql: String, prepare: Prepare, extractor: () => T)(info: ExecutionInfo, dc: Runner): CIO[List[T]]
def executeQuerySingle[T](cql: String, prepare: Prepare, extractor: () => T)(info: ExecutionInfo, dc: Runner): CIO[T]
def probe(statement: String): Try[_]
@targetName("runQueryDefault")
inline
def run[T](inline quoted: Quoted[Query[T]]): ZIO[Has[CassandraZioSession], Throwable, List[T]]
@targetName("runQuery")
inline
def run[T](inline quoted: Quoted[Query[T]], inline wrap: OuterSelectWrap): ZIO[Has[CassandraZioSession], Throwable, List[T]]
@targetName("runQuerySingle")
inline
def run[T](inline quoted: Quoted[T]): ZIO[Has[CassandraZioSession], Throwable, T]
@targetName("runAction")
inline
def run[E](inline quoted: Quoted[Action[E]]): ZIO[Has[CassandraZioSession], Throwable, Unit]
@targetName("runBatchAction")
inline
def run[I, A <: Action[I] & QAC[I, Nothing]](inline quoted: Quoted[BatchAction[A]]): ZIO[Has[CassandraZioSession], Throwable, Unit]
def streamQuery[T](fetchSize: Option[Int], cql: String, prepare: Prepare, extractor: () => T)(info: ExecutionInfo, dc: Runner): CStream[T]

Inherited methods

inline
def _streamInternal[T](inline quoted: Quoted[Query[T]], fetchSize: Option[Int]): CStream[T]

Internal API that cannot be made private due to how inline functions

Internal API that cannot be made private due to how inline functions

Inherited from
ContextVerbStream
def decoder[T](f: ResultRow => Int => T): CassandraDecoder[T]
Inherited from
Decoders
def decoder[T](d: (Int, ResultRow, Session) => T): CassandraDecoder[T]
Inherited from
Decoders
def encoder[T](f: PrepareRow => (Int, T) => PrepareRow): CassandraEncoder[T]
Inherited from
Encoders
Inherited from
Encoders
override
def executeActionReturning[O](sql: String, prepare: Prepare, extractor: () => O, returningBehavior: ReturnAction)(info: ExecutionInfo, dc: Runner): CIO[RunActionReturningResult[O]]
Definition Classes
CassandraStandardContext -> ProtoContext
Inherited from
CassandraStandardContext
override
def executeBatchActionReturning[T](groups: List[BatchGroupReturning], extractor: () => T)(info: ExecutionInfo, dc: Runner): CIO[RunBatchActionReturningResult[T]]
Definition Classes
CassandraStandardContext -> ProtoContext
Inherited from
CassandraStandardContext
protected
def handleSingleResult[T](list: List[T]): T
Inherited from
Context
inline
def lift[T](inline runtimeValue: T): T
Inherited from
Context
inline
def liftQuery[U <: ([_] =>> Iterable[_]), T](inline runtimeValue: U[T]): Query[T]
Inherited from
Context
protected
def mappedBaseDecoder[Base, Mapped](mapped: MappedEncoding[Base, Mapped], decoder: () => Base): () => Mapped
Inherited from
EncodingDsl
protected
def mappedBaseEncoder[Mapped, Base](mapped: MappedEncoding[Mapped, Base], encoder: () => Base): () => Mapped
Inherited from
EncodingDsl
@targetName("streamQueryWithFetchSize")
inline
def stream[T](inline quoted: Quoted[Query[T]], fetchSize: Int): CStream[T]
Inherited from
ContextVerbStream
@targetName("streamQuery")
inline
def stream[T](inline quoted: Quoted[Query[T]]): CStream[T]
Inherited from
ContextVerbStream

Concrete fields

val naming: N
val streamBlocker: ZStream[Any, Nothing, Any]

Inherited fields

Inherited from
RowContext
protected
val identityPrepare: Prepare
Inherited from
RowContext
val idiom: CqlIdiom
Inherited from
CassandraRowContext
protected
val zoneId: ZoneId
Inherited from
Encodings

Extensions

Inherited extensions

extension [T](q: Query[T])
inline
def filterByKeys(inline map: Map[String, String]): Query[T]

When using this with FilterColumns make sure it comes FIRST. Otherwise the columns are you filtering may have been nullified in the SQL before the filteration has actually happened.

When using this with FilterColumns make sure it comes FIRST. Otherwise the columns are you filtering may have been nullified in the SQL before the filteration has actually happened.

Inherited from
Context
inline
def filterColumns(inline columns: List[String]): Query[T]
Inherited from
Context

Implicits

Inherited implicits

final implicit
def CioExt[T](cio: CIO[T]): CioExt[T]
Inherited from
CioOps
implicit inline
def anyValDecoder[Cls <: AnyVal]: CassandraDecoder[Cls]
Inherited from
LowPriorityImplicits
implicit inline
def anyValEncoder[Cls <: AnyVal]: CassandraEncoder[Cls]
Inherited from
LowPriorityImplicits
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
val booleanCassandraType: CassandraType[Boolean]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
val byteBufferCassandraType: CassandraType[ByteBuffer]
Inherited from
CassandraTypes
implicit
val byteCassandraType: CassandraType[Byte]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
def cassandraIdentityDecodeMapper[Cas](implicit cas: CassandraType[Cas]): CassandraMapper[Cas, Cas, Decode]
Inherited from
CassandraMapperConversions
implicit
def cassandraIdentityEncodeMapper[Cas](implicit cas: CassandraType[Cas]): CassandraMapper[Cas, Cas, Encode]
Inherited from
CassandraMapperConversions
Inherited from
Decoders
Inherited from
Encoders
Inherited from
Decoders
Inherited from
Encoders
implicit
def cassandraMapperDecode[T, Cas](implicit m: MappedEncoding[Cas, T], cas: CassandraType[Cas]): CassandraMapper[Cas, T, Decode]
Inherited from
CassandraMapperConversions
implicit
def cassandraMapperDecodeRec[I, O, Cas](implicit m: MappedEncoding[I, O], cm: CassandraMapper[Cas, I, Decode]): CassandraMapper[Cas, O, Decode]
Inherited from
CassandraMapperConversionsLowPriorityImplicits
implicit
def cassandraMapperEncode[T, Cas](implicit m: MappedEncoding[T, Cas], cas: CassandraType[Cas]): CassandraMapper[T, Cas, Encode]
Inherited from
CassandraMapperConversions
implicit
def cassandraMapperEncodeRec[I, O, Cas](implicit me: MappedEncoding[I, O], cm: CassandraMapper[O, Cas, Encode]): CassandraMapper[I, Cas, Encode]
Inherited from
CassandraMapperConversionsLowPriorityImplicits
implicit
val dateCassandraType: CassandraType[Instant]
Inherited from
CassandraTypes
implicit inline
def dec[T]: GenericDecoder[ResultRow, Session, T, Generic]
Inherited from
Context
implicit
val decimalCassandraType: CassandraType[BigDecimal]
Inherited from
CassandraTypes
implicit
val decodeBigDecimal: CassandraMapper[BigDecimal, BigDecimal, Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeBoolean: CassandraMapper[Boolean, Boolean, Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeByte: CassandraMapper[Byte, Byte, Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeByteArray: CassandraMapper[ByteBuffer, Array[Byte], Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeDouble: CassandraMapper[Double, Double, Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeFloat: CassandraMapper[Float, Float, Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeInt: CassandraMapper[Integer, Int, Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeJava8ZonedDateTime: MappedEncoding[Instant, ZonedDateTime]
Inherited from
Encodings
implicit
val decodeLong: CassandraMapper[Long, Long, Decode]
Inherited from
CassandraMappedTypes
implicit
val decodeShort: CassandraMapper[Short, Short, Decode]
Inherited from
CassandraMappedTypes
implicit
val doubleCassandraType: CassandraType[Double]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
val encodeBigDecimal: CassandraMapper[BigDecimal, BigDecimal, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeBoolean: CassandraMapper[Boolean, Boolean, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeByte: CassandraMapper[Byte, Byte, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeByteArray: CassandraMapper[Array[Byte], ByteBuffer, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeDouble: CassandraMapper[Double, Double, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeFloat: CassandraMapper[Float, Float, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeInt: CassandraMapper[Int, Integer, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeJava8ZonedDateTime: MappedEncoding[ZonedDateTime, Instant]
Inherited from
Encodings
implicit
val encodeLong: CassandraMapper[Long, Long, Encode]
Inherited from
CassandraMappedTypes
implicit
val encodeShort: CassandraMapper[Short, Short, Encode]
Inherited from
CassandraMappedTypes
implicit
val floatCassandraType: CassandraType[Float]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
val integerCassandraType: CassandraType[Integer]
Inherited from
CassandraTypes
implicit
def listDecoder[T, Cas](implicit mapper: CassandraMapper[Cas, T, Decode], ct: ClassTag[Cas]): CassandraDecoder[List[T]]
Inherited from
CollectionDecoders
implicit
def listEncoder[T, Cas](implicit mapper: CassandraMapper[T, Cas, Encode], ct: ClassTag[Cas]): CassandraEncoder[List[T]]
Inherited from
CollectionEncoders
implicit
val localDateCassandraType: CassandraType[LocalDate]
Inherited from
CassandraTypes
implicit
val longCassandraType: CassandraType[Long]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
def mapDecoder[K, V, KCas, VCas](implicit keyMapper: CassandraMapper[KCas, K, Decode], valMapper: CassandraMapper[VCas, V, Decode], a: ClassTag[KCas], b: ClassTag[VCas]): CassandraDecoder[Map[K, V]]
Inherited from
CollectionDecoders
implicit
def mapEncoder[K, V, KCas, VCas](implicit keyMapper: CassandraMapper[K, KCas, Encode], valMapper: CassandraMapper[V, VCas, Encode], a: ClassTag[KCas], b: ClassTag[VCas]): CassandraEncoder[Map[K, V]]
Inherited from
CollectionEncoders
implicit
def mappedDecoder[I, O](implicit mapped: MappedEncoding[I, O], decoder: CassandraDecoder[I]): CassandraDecoder[O]
Inherited from
Decoders
implicit
def mappedEncoder[I, O](implicit mapped: MappedEncoding[I, O], encoder: CassandraEncoder[O]): CassandraEncoder[I]
Inherited from
Encoders
implicit
def optionDecoder[T](implicit d: CassandraDecoder[T]): CassandraDecoder[Option[T]]
Inherited from
Decoders
implicit
def optionEncoder[T](implicit d: CassandraEncoder[T]): CassandraEncoder[Option[T]]
Inherited from
Encoders
implicit
def setDecoder[T, Cas](implicit mapper: CassandraMapper[Cas, T, Decode], ct: ClassTag[Cas]): CassandraDecoder[Set[T]]
Inherited from
CollectionDecoders
implicit
def setEncoder[T, Cas](implicit mapper: CassandraMapper[T, Cas, Encode], ct: ClassTag[Cas]): CassandraEncoder[Set[T]]
Inherited from
CollectionEncoders
implicit
val shortCassandraType: CassandraType[Short]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
val stringCassandraType: CassandraType[String]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders
implicit inline
def udtDecodeMapper[T <: Udt](using NotGiven[T =:= Udt]): CassandraMapper[UdtValue, T, Decode]
Inherited from
UdtDecoding
implicit inline
def udtDecoder[T <: Udt](using NotGiven[T =:= Udt]): CassandraDecoder[T]
Inherited from
UdtDecoding
implicit inline
def udtEncodeMapper[T <: Udt]: CassandraMapper[T, UdtValue, Encode]
Inherited from
UdtEncoding
implicit inline
def udtEncoder[T <: Udt]: CassandraEncoder[T]
Inherited from
UdtEncoding
implicit
val uuidCassandraType: CassandraType[UUID]
Inherited from
CassandraTypes
implicit
Inherited from
Decoders
implicit
Inherited from
Encoders