Releases: kaizen-solutions/virgil
Release for ZIO 2.0.4
Updates to underlying libraries
Release for ZIO 2.0.0
Virgil now supports ZIO 2.0
- Underlying Cassandra metrics have been exposed (Thanks to @narma)
Expose metrics [zio1]
Thanks to @narma for exposing metrics
Add stripMargin to CqlInterpolatedString
We've added stripMargin
which only works on the string portions of the cql query
val query =
cql"""SELECT id, name, persons
|FROM persons
|WHERE id = ${1} AND name = ${"cal"}""".stripMargin
// SELECT id, name, persons
// FROM persons
// WHERE id = :param0 AND name = :param1
Add stripMargin to CqlInterpolatedString
We've added stripMargin
which only works on the string portions of the cql query
val query =
cql"""SELECT id, name, persons
|FROM persons
|WHERE id = ${1} AND name = ${"cal"}""".stripMargin
// SELECT id, name, persons
// FROM persons
// WHERE id = :param0 AND name = :param1
Bugfix for ZIO 2
Fixes the counter syntax and a CQL rendering bug pertaining to counter columns.
Here's some example usage
UpdateBuilder(tableName).set(Likes += in.likes).where(Id === in.id).build
Bugfix for ZIO 1
Fixes the counter syntax and a CQL rendering bug pertaining to counter columns.
Here's some example usage
UpdateBuilder(tableName).set(Likes += in.likes).where(Id === in.id).build
ZIO 2.0.0-RC6 support
select
has been rewritten atopZChannel
s to reduce allocations and improve performance- users of the API get better error information thanks to making use of
Trace
- Upgrade to ZIO 2.0.0-RC6
Scala 3
Virgil now has support for Scala 3. Codecs only have semi-automatic derivation but we'll get there 😸
final case class CursorExampleRow(
id: Long,
name: String,
age: Short,
@CqlColumn("may_be_empty") mayBeEmpty: Option[String],
@CqlColumn("addresses") pastAddresses: Chunk[CursorUdtAddress]
)
object CursorExampleRow {
given cqlRowDecoderForCursorExampleRow: CqlRowDecoder.Object[CursorExampleRow] =
CqlRowDecoder.derive[CursorExampleRow]
val tableName = "cursorspec_cursorexampletable"
def truncate: CQL[MutationResult] = CQL.truncate(tableName)
def insert(row: CursorExampleRow): CQL[MutationResult] =
InsertBuilder(tableName)
.values(
"id" -> row.id,
"name" -> row.name,
"age" -> row.age,
"addresses" -> row.pastAddresses,
"may_be_empty" -> row.mayBeEmpty
)
.build
def select(id: Long): CQL[Row] = {
val cql = cql"SELECT * FROM " ++ tableName.asCql ++ cql" WHERE id = $id"
cql.query
}
}
final case class CursorUdtAddress(street: String, city: String, state: String, zip: String, note: CursorUdtNote)
object CursorUdtAddress {
given cqlUdtValueDecoderForCursorUdtAddress: CqlUdtValueDecoder.Object[CursorUdtAddress] =
CqlUdtValueDecoder.derive[CursorUdtAddress]
given cqlUdtValueEncoderForCursorUdtAddress: CqlUdtValueEncoder.Object[CursorUdtAddress] =
CqlUdtValueEncoder.derive[CursorUdtAddress]
}
final case class CursorUdtNote(data: String, ip: InetAddress)
object CursorUdtNote {
given cqlUdtValueDecoderForCursorUdtNote: CqlUdtValueDecoder.Object[CursorUdtNote] =
CqlUdtValueDecoder.derive[CursorUdtNote]
given cqlUdtValueEncoderForCursorUdtNote: CqlUdtValueEncoder.Object[CursorUdtNote] =
CqlUdtValueEncoder.derive[CursorUdtNote]
}
ZIO 2.0 RC5 support
This release supports the latesrt version of ZIO 2.0 which is RC5 at the time. ZManaged and Has are deleted and we exclusively rely on Scopes to manage resources (like CqlSession and CQLExecutor).