Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to change EntityQuery.insert(CaseClass) to EntityQuery.insertValue(CaseClass) for upstream Scala 3 issues. #2379

Merged
merged 1 commit into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DecodeNullSpec extends Spec {
val result =
for {
_ <- testMonixDB.run(writeEntities.delete)
_ <- testMonixDB.run(writeEntities.insert(lift(insertValue)))
_ <- testMonixDB.run(writeEntities.insertValue(lift(insertValue)))
result <- testMonixDB.run(query[DecodeNullTestEntity])
} yield {
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EncodingSpec extends EncodingSpecHelper {
val result =
for {
_ <- testMonixDB.run(query[EncodingTestEntity].delete)
_ <- testMonixDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
_ <- testMonixDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
result <- testMonixDB.run(query[EncodingTestEntity])
} yield {
result
Expand All @@ -32,7 +32,7 @@ class EncodingSpec extends EncodingSpecHelper {
val result =
for {
_ <- testMonixDB.run(query[EncodingTestEntity].delete)
_ <- testMonixDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
_ <- testMonixDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
result <- testMonixDB.run(q(liftQuery(insertValues.map(_.id))))
} yield {
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DecodeNullSpec extends Spec {
val result =
for {
_ <- testStreamDB.run(writeEntities.delete)
_ <- Observable.fromTask(testStreamDB.run(writeEntities.insert(lift(insertValue))).countL)
_ <- Observable.fromTask(testStreamDB.run(writeEntities.insertValue(lift(insertValue))).countL)
result <- testStreamDB.run(query[DecodeNullTestEntity])
} yield {
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EncodingSpec extends EncodingSpecHelper {
for {
_ <- testStreamDB.run(query[EncodingTestEntity].delete)
inserts = Observable(insertValues: _*)
_ <- Observable.fromTask(testStreamDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e))).countL)
_ <- Observable.fromTask(testStreamDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e))).countL)
result <- testStreamDB.run(query[EncodingTestEntity])
} yield {
result
Expand All @@ -35,7 +35,7 @@ class EncodingSpec extends EncodingSpecHelper {
for {
_ <- testStreamDB.run(query[EncodingTestEntity].delete)
inserts = Observable(insertValues: _*)
_ <- Observable.fromTask(testStreamDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e))).countL)
_ <- Observable.fromTask(testStreamDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e))).countL)
result <- testStreamDB.run(q(liftQuery(insertValues.map(_.id))))
} yield {
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DecodeNullSpec extends ZioCassandraSpec {
val ret =
for {
_ <- testZioDB.run(writeEntities.delete)
_ <- testZioDB.run(writeEntities.insert(lift(insertValue)))
_ <- testZioDB.run(writeEntities.insertValue(lift(insertValue)))
result <- testZioDB.run(query[DecodeNullTestEntity])
} yield {
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EncodingSpec extends EncodingSpecHelper with ZioCassandraSpec {
val ret =
for {
_ <- testZioDB.run(query[EncodingTestEntity].delete)
_ <- testZioDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
_ <- testZioDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
result <- testZioDB.run(query[EncodingTestEntity])
} yield {
result
Expand All @@ -30,7 +30,7 @@ class EncodingSpec extends EncodingSpecHelper with ZioCassandraSpec {
val ret =
for {
_ <- testZioDB.run(query[EncodingTestEntity].delete)
_ <- testZioDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
_ <- testZioDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
result <- testZioDB.run(q(liftQuery(insertValues.map(_.id))))
} yield {
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class UdtEncodingSessionContextSpec extends UdtSpec with ZioCassandraSpec {
Set(1, 2),
Map(1 -> "1", 2 -> "2")),
List(Name("first", None)))
ctx.run(query[WithEverything].insert(lift(e))).runSyncUnsafe()
ctx.run(query[WithEverything].insertValue(lift(e))).runSyncUnsafe()
ctx.run(query[WithEverything].filter(_.id == 1)).runSyncUnsafe().headOption must contain(e)
}
"with meta" in {
Expand All @@ -62,7 +62,7 @@ class UdtEncodingSessionContextSpec extends UdtSpec with ZioCassandraSpec {
implicit val myNameMeta = udtMeta[MyName]("Name", _.first -> "firstName")

val e = WithEverything(2, MyName("first"), List(MyName("first")))
ctx.run(query[WithEverything].insert(lift(e))).runSyncUnsafe()
ctx.run(query[WithEverything].insertValue(lift(e))).runSyncUnsafe()
ctx.run(query[WithEverything].filter(_.id == 2)).runSyncUnsafe().headOption must contain(e)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CaseClassQueryCassandraSpec extends Spec {
case class Address(id: Int, street: String, zip: Int, otherExtraInfo: String)

val peopleInsert =
quote((p: Contact) => query[Contact].insert(p))
quote((p: Contact) => query[Contact].insertValue(p))

val peopleEntries = List(
Contact(1, "Alex", "Jones", 60, 2, "foo"),
Expand All @@ -19,7 +19,7 @@ class CaseClassQueryCassandraSpec extends Spec {
)

val addressInsert =
quote((c: Address) => query[Address].insert(c))
quote((c: Address) => query[Address].insertValue(c))

val addressEntries = List(
Address(1, "123 Fake Street", 11234, "something"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class CqlIdiomSpec extends Spec {
"action" - {
"insert" in {
val q = quote {
qr1.insert(lift(TestEntity("s", 1, 2L, None, true)))
qr1.insertValue(lift(TestEntity("s", 1, 2L, None, true)))
}
mirrorContext.run(q).string mustEqual
"INSERT INTO TestEntity (s,i,l,o,b) VALUES (?, ?, ?, ?, ?)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DecodeNullSpec extends Spec {
val writeEntities = quote(querySchema[DecodeNullTestWriteEntity]("DecodeNullTestEntity"))

testSyncDB.run(writeEntities.delete)
testSyncDB.run(writeEntities.insert(lift(insertValue)))
testSyncDB.run(writeEntities.insertValue(lift(insertValue)))
intercept[IllegalStateException] {
testSyncDB.run(query[DecodeNullTestEntity])
}
Expand All @@ -25,7 +25,7 @@ class DecodeNullSpec extends Spec {
val result =
for {
_ <- testAsyncDB.run(writeEntities.delete)
_ <- testAsyncDB.run(writeEntities.insert(lift(insertValue)))
_ <- testAsyncDB.run(writeEntities.insertValue(lift(insertValue)))
result <- testAsyncDB.run(query[DecodeNullTestEntity])
} yield {
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EncodingSpec extends EncodingSpecHelper {
"sync" in {
import testSyncDB._
testSyncDB.run(query[EncodingTestEntity].delete)
testSyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
testSyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
verify(testSyncDB.run(query[EncodingTestEntity]))
}

Expand All @@ -20,7 +20,7 @@ class EncodingSpec extends EncodingSpecHelper {
await {
for {
_ <- testAsyncDB.run(query[EncodingTestEntity].delete)
_ <- testAsyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
_ <- testAsyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
result <- testAsyncDB.run(query[EncodingTestEntity])
} yield {
verify(result)
Expand All @@ -37,7 +37,7 @@ class EncodingSpec extends EncodingSpecHelper {
query[EncodingTestEntity].filter(t => list.contains(t.id))
}
testSyncDB.run(query[EncodingTestEntity])
testSyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
testSyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
verify(testSyncDB.run(q(liftQuery(insertValues.map(_.id)))))
}

Expand All @@ -51,7 +51,7 @@ class EncodingSpec extends EncodingSpecHelper {
await {
for {
_ <- testAsyncDB.run(query[EncodingTestEntity].delete)
_ <- testAsyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insert(e)))
_ <- testAsyncDB.run(liftQuery(insertValues).foreach(e => query[EncodingTestEntity].insertValue(e)))
r <- testAsyncDB.run(q(liftQuery(insertValues.map(_.id))))
} yield {
verify(r)
Expand Down Expand Up @@ -99,11 +99,11 @@ class EncodingSpec extends EncodingSpecHelper {
val c = CasTypes(LocalDate.ofEpochDay(epohDay), Instant.ofEpochMilli(epoh), Some(zonedDateTime))

ctx.run(jq.delete)
ctx.run(jq.insert(lift(j)))
ctx.run(jq.insertValue(lift(j)))
ctx.run(cq).headOption mustBe Some(c)

ctx.run(cq.delete)
ctx.run(cq.insert(lift(c)))
ctx.run(cq.insertValue(lift(c)))
ctx.run(jq).headOption mustBe Some(j)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ListsEncodingSpec extends CollectionsSpec {
val q = quote(query[ListsEntity])

"List encoders/decoders for CassandraTypes and CassandraMappers" in {
ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -38,7 +38,7 @@ class ListsEncodingSpec extends CollectionsSpec {
val e = Entity(1, Some(List("1", "2")), None, Nil)
val q = quote(querySchema[Entity]("ListsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
val r = ctx.run(q.filter(_.id == 1)).head
ctx.run(q.filter(_.id == 1)).head mustBe e
}
Expand All @@ -48,7 +48,7 @@ class ListsEncodingSpec extends CollectionsSpec {
val e = StrEntity(1, List("1", "2").map(StrWrap.apply))
val q = quote(querySchema[StrEntity]("ListsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -57,7 +57,7 @@ class ListsEncodingSpec extends CollectionsSpec {
val e = IntEntity(1, List(1, 2).map(IntWrap.apply))
val q = quote(querySchema[IntEntity]("ListsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -66,14 +66,14 @@ class ListsEncodingSpec extends CollectionsSpec {
val e = BlobsEntity(1, List(Array(1.toByte, 2.toByte), Array(2.toByte)))
val q = quote(querySchema[BlobsEntity]("ListsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1))
.head.blobs.map(_.toList) mustBe e.blobs.map(_.toList)
}

"List in where clause / contains" in {
val e = ListFrozen(List(1, 2))
ctx.run(listFroz.insert(lift(e)))
ctx.run(listFroz.insertValue(lift(e)))
ctx.run(listFroz.filter(_.id == lift(List(1, 2)))) mustBe List(e)
ctx.run(listFroz.filter(_.id == lift(List(1)))) mustBe Nil

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MapsEncodingSpec extends CollectionsSpec {
val q = quote(query[MapsEntity])

"Map encoders/decoders" in {
ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -35,7 +35,7 @@ class MapsEncodingSpec extends CollectionsSpec {
val e = Entity(1, Some(Map("1" -> BigDecimal(1))), None, Map())
val q = quote(querySchema[Entity]("MapsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -44,7 +44,7 @@ class MapsEncodingSpec extends CollectionsSpec {
val e = StrEntity(1, Map(StrWrap("1") -> BigDecimal(1)))
val q = quote(querySchema[StrEntity]("MapsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -53,13 +53,13 @@ class MapsEncodingSpec extends CollectionsSpec {
val e = IntEntity(1, Map(IntWrap(1) -> 1d))
val q = quote(querySchema[IntEntity]("MapsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

"Map in where clause / contains" in {
val e = MapFrozen(Map(1 -> true))
ctx.run(mapFroz.insert(lift(e)))
ctx.run(mapFroz.insertValue(lift(e)))
ctx.run(mapFroz.filter(_.id == lift(Map(1 -> true)))) mustBe List(e)
ctx.run(mapFroz.filter(_.id == lift(Map(1 -> false)))) mustBe Nil

Expand All @@ -69,7 +69,7 @@ class MapsEncodingSpec extends CollectionsSpec {

"Map.containsValue" in {
val e = MapFrozen(Map(1 -> true))
ctx.run(mapFroz.insert(lift(e)))
ctx.run(mapFroz.insertValue(lift(e)))

ctx.run(mapFroz.filter(_.id.containsValue(true)).allowFiltering) mustBe List(e)
ctx.run(mapFroz.filter(_.id.containsValue(false)).allowFiltering) mustBe Nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PeopleCassandraSpec extends Spec {
Person(5, "Dre", 60)
)
testSyncDB.run(query[Person].delete)
testSyncDB.run(liftQuery(entries).foreach(e => query[Person].insert(e)))
testSyncDB.run(liftQuery(entries).foreach(e => query[Person].insertValue(e)))
()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait QueryResultTypeCassandraSpec extends Spec {
OrderTestEntity(3, 3)
)

val insert = quote((e: OrderTestEntity) => query[OrderTestEntity].insert(e))
val insert = quote((e: OrderTestEntity) => query[OrderTestEntity].insertValue(e))
val deleteAll = quote(query[OrderTestEntity].delete)
val selectAll = quote(query[OrderTestEntity])
val map = quote(query[OrderTestEntity].map(_.id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SetsEncodingSpec extends CollectionsSpec {
val q = quote(query[SetsEntity])

"Set encoders/decoders" in {
ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -35,7 +35,7 @@ class SetsEncodingSpec extends CollectionsSpec {
val e = Entity(1, Some(Set("1", "2")), None, Set())
val q = quote(querySchema[Entity]("SetsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -44,7 +44,7 @@ class SetsEncodingSpec extends CollectionsSpec {
val e = StrEntity(1, Set("1", "2").map(StrWrap.apply))
val q = quote(querySchema[StrEntity]("SetsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -53,7 +53,7 @@ class SetsEncodingSpec extends CollectionsSpec {
val e = IntEntity(1, Set(1, 2).map(IntWrap.apply))
val q = quote(querySchema[IntEntity]("SetsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1)).head mustBe e
}

Expand All @@ -62,14 +62,14 @@ class SetsEncodingSpec extends CollectionsSpec {
val e = BlobsEntity(1, Set(Array(1.toByte, 2.toByte), Array(2.toByte)))
val q = quote(querySchema[BlobsEntity]("SetsEntity"))

ctx.run(q.insert(lift(e)))
ctx.run(q.insertValue(lift(e)))
ctx.run(q.filter(_.id == 1))
.head.blobs.map(_.toSet) mustBe e.blobs.map(_.toSet)
}

"Set in where clause" in {
val e = SetFrozen(Set(1, 2))
ctx.run(setFroz.insert(lift(e)))
ctx.run(setFroz.insertValue(lift(e)))
ctx.run(setFroz.filter(_.id == lift(Set(1, 2)))) mustBe List(e)
ctx.run(setFroz.filter(_.id == lift(Set(1)))) mustBe List()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RenamePropertiesSpec extends Spec {
"action" - {
"insert" in {
val q = quote {
e.insert(lift(TestEntity("a", 1, 1L, None, true)))
e.insertValue(lift(TestEntity("a", 1, 1L, None, true)))
}
mirrorContext.run(q).string mustEqual
"INSERT INTO test_entity (field_s,field_i,l,o,b) VALUES (?, ?, ?, ?, ?)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ class UdtEncodingMirrorContextSpec extends UdtSpec {
case class User(id: Int, name: Name, names: List[Name])
mirrorContext.run(query[User]).string mustBe "SELECT id, name, names FROM User"
mirrorContext.run(query[User]
.insert(lift(User(1, Name("1", None), Nil)))).string mustBe "INSERT INTO User (id,name,names) VALUES (?, ?, ?)"
.insertValue(lift(User(1, Name("1", None), Nil)))).string mustBe "INSERT INTO User (id,name,names) VALUES (?, ?, ?)"
}
}
Loading