diff --git a/phantom-connectors/src/main/scala/com/outworkers/phantom/connectors/Versions.scala b/phantom-connectors/src/main/scala/com/outworkers/phantom/connectors/Versions.scala index 02751de5f..fa4de87ec 100644 --- a/phantom-connectors/src/main/scala/com/outworkers/phantom/connectors/Versions.scala +++ b/phantom-connectors/src/main/scala/com/outworkers/phantom/connectors/Versions.scala @@ -56,4 +56,5 @@ object DefaultVersions { val `3.6.0` = Version(3, 6, 0) val `3.7.0` = Version(3, 7, 0) val `3.8.0` = Version(3, 8, 0) + val `3.10.0` = Version(3, 10, 0) } \ No newline at end of file diff --git a/phantom-dsl/src/main/scala/com/outworkers/phantom/builder/ops/ImplicitMechanism.scala b/phantom-dsl/src/main/scala/com/outworkers/phantom/builder/ops/ImplicitMechanism.scala index c19d64fbc..13e3d1560 100644 --- a/phantom-dsl/src/main/scala/com/outworkers/phantom/builder/ops/ImplicitMechanism.scala +++ b/phantom-dsl/src/main/scala/com/outworkers/phantom/builder/ops/ImplicitMechanism.scala @@ -174,6 +174,10 @@ private[phantom] trait ImplicitMechanism extends ModifyMechanism { new MapEntriesConditionals[K, V](cond) } + implicit def nonIndexedColumnQueries[RR : Primitive](col: AbstractColumn[RR])( + implicit ev: col.type <:!< Indexed + ): QueryColumn[RR] = new QueryColumn[RR](col.name) + implicit def partitionColumnQueries[RR : Primitive]( col: AbstractColumn[RR] with PartitionKey ): PartitionQueryColumn[RR] = new PartitionQueryColumn[RR](col.name) diff --git a/phantom-dsl/src/main/scala/com/outworkers/phantom/keys/PrimaryKey.scala b/phantom-dsl/src/main/scala/com/outworkers/phantom/keys/PrimaryKey.scala index 86630fa93..a4faa3cc0 100644 --- a/phantom-dsl/src/main/scala/com/outworkers/phantom/keys/PrimaryKey.scala +++ b/phantom-dsl/src/main/scala/com/outworkers/phantom/keys/PrimaryKey.scala @@ -24,7 +24,9 @@ private[phantom] trait Unmodifiable private[phantom] trait Indexed object Indexed { - implicit def indexedToQueryColumn[T : Primitive](col: AbstractColumn[T] with Indexed): QueryColumn[T] = { + implicit def indexedToQueryColumn[T : Primitive]( + col: AbstractColumn[T] with Indexed + ): QueryColumn[T] = { new QueryColumn(col.name) } diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/InsertTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/InsertTest.scala index d36f8e310..853634680 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/InsertTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/InsertTest.scala @@ -44,7 +44,7 @@ class InsertTest extends PhantomSuite { val row = gen[OldPrimitiveRecord].copy(timeuuid = UUIDs.timeBased()) val chain = for { - store <- database.oldPrimitives.store(row).future() + _ <- database.oldPrimitives.store(row).future() one <- database.oldPrimitives.select.where(_.pkey eqs row.pkey).one } yield one @@ -57,7 +57,7 @@ class InsertTest extends PhantomSuite { val row = gen[PrimitiveRecord] val chain = for { - store <- database.primitives.store(row).future() + _ <- database.primitives.store(row).future() one <- database.primitives.select.where(_.pkey eqs row.pkey).one } yield one @@ -68,11 +68,10 @@ class InsertTest extends PhantomSuite { if (session.v4orNewer) { "Insert" should "work fine for primitives cassandra 2.2 columns" in { - JodaTimeSampler val row = gen[PrimitiveCassandra22] val chain = for { - store <- database.primitivesCassandra22.store(row).future() + _ <- database.primitivesCassandra22.store(row).future() one <- database.primitivesCassandra22.select.where(_.pkey eqs row.pkey).one } yield one @@ -86,7 +85,7 @@ class InsertTest extends PhantomSuite { val row = gen[TestRow].copy(key = "test'", mapIntToInt = Map.empty[Int, Int]) val chain = for { - store <- database.testTable.store(row).future() + _ <- database.testTable.store(row).future() one <- database.testTable.select.where(_.key eqs row.key).one } yield one @@ -99,7 +98,7 @@ class InsertTest extends PhantomSuite { val row = gen[TestRow].copy(mapIntToInt = Map.empty) val chain = for { - store <- database.testTable.store(row).future() + _ <- database.testTable.store(row).future() one <- database.testTable.select.where(_.key eqs row.key).one } yield one @@ -112,7 +111,7 @@ class InsertTest extends PhantomSuite { val recipe = gen[Recipe] val chain = for { - store <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() one <- database.recipes.select.where(_.url eqs recipe.url).one } yield one @@ -131,7 +130,7 @@ class InsertTest extends PhantomSuite { val row = gen[MyTestRow].copy(stringlist = List.empty) val chain = for { - store <- database.listCollectionTable.store(row).future() + _ <- database.listCollectionTable.store(row).future() one <- database.listCollectionTable.select.where(_.key eqs row.key).one } yield one @@ -145,7 +144,7 @@ class InsertTest extends PhantomSuite { val row = gen[MyTestRow] val chain = for { - store <- database.listCollectionTable.store(row).future() + _ <- database.listCollectionTable.store(row).future() get <- database.listCollectionTable.select.where(_.key eqs row.key).one } yield get @@ -158,7 +157,7 @@ class InsertTest extends PhantomSuite { val sample = gen[Recipe] val chain = for { - store <- database.recipes.insert.json(compactJson(renderJValue(Extraction.decompose(sample)))).future() + _ <- database.recipes.insert.json(compactJson(renderJValue(Extraction.decompose(sample)))).future() get <- database.recipes.select.where(_.url eqs sample.url).one() } yield get @@ -176,7 +175,7 @@ class InsertTest extends PhantomSuite { val sample = gen[OptTypesRecord].copy(wrapped = None) val chain = for { - store <- database.optDerivedTable.store(sample).future() + _ <- database.optDerivedTable.store(sample).future() res <- database.optDerivedTable.select.where(_.pkey eqs sample.pkey).one() } yield res @@ -190,7 +189,7 @@ class InsertTest extends PhantomSuite { val sample = gen[OptTypesRecord] val chain = for { - store <- database.optDerivedTable.store(sample).future() + _ <- database.optDerivedTable.store(sample).future() res <- database.optDerivedTable.select.where(_.pkey eqs sample.pkey).one() } yield res diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/ListOperatorsTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/ListOperatorsTest.scala index feee85028..4bb546dec 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/ListOperatorsTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/ListOperatorsTest.scala @@ -51,7 +51,7 @@ class ListOperatorsTest extends PhantomSuite { whenReady(operation) { items => items.value shouldEqual recipe.ingredients - items.value should have size recipe.ingredients.size + items.value should have size recipe.ingredients.size.toLong } } diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/MapOperationsTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/MapOperationsTest.scala index fb01499dd..b0820e4f3 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/MapOperationsTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/MapOperationsTest.scala @@ -35,8 +35,8 @@ class MapOperationsTest extends PhantomSuite { val (key , value) = gen[(String, String)] val operation = for { - insertDone <- database.recipes.store(recipe).future() - update <- database.recipes.update.where(_.url eqs recipe.url).modify(_.props set (key, value)).future() + _ <- database.recipes.store(recipe).future() + _ <- database.recipes.update.where(_.url eqs recipe.url).modify(_.props set (key, value)).future() select <- database.recipes.select(_.props).where(_.url eqs recipe.url).one } yield select @@ -55,8 +55,8 @@ class MapOperationsTest extends PhantomSuite { val query = database.recipes.update.where(_.url eqs ?).modify(_.props set ?).prepareAsync() val operation = for { - insertDone <- database.recipes.store(recipe).future() - update <- query.flatMap(_.bind(key, value, recipe.url).future()) + _ <- database.recipes.store(recipe).future() + _ <- query.flatMap(_.bind(key, value, recipe.url).future()) select <- database.recipes.select(_.props).where(_.url eqs recipe.url).one } yield select @@ -73,8 +73,8 @@ class MapOperationsTest extends PhantomSuite { val item = gen[(String, String)] val operation = for { - insertDone <- database.recipes.store(recipe).future() - update <- database.recipes.update.where(_.url eqs recipe.url).modify(_.props put item).future() + _ <- database.recipes.store(recipe).future() + _ <- database.recipes.update.where(_.url eqs recipe.url).modify(_.props put item).future() select <- database.recipes.select(_.props).where(_.url eqs recipe.url).one } yield select @@ -89,8 +89,8 @@ class MapOperationsTest extends PhantomSuite { val mapItems = genMap[String, String](mapSize) val operation = for { - insertDone <- database.recipes.store(recipe).future() - update <- database.recipes.update.where(_.url eqs recipe.url).modify(_.props putAll mapItems).future() + _ <- database.recipes.store(recipe).future() + _ <- database.recipes.update.where(_.url eqs recipe.url).modify(_.props putAll mapItems).future() select <- database.recipes.select(_.props).where(_.url eqs recipe.url).one } yield select @@ -107,8 +107,8 @@ class MapOperationsTest extends PhantomSuite { val updateQuery = database.recipes.update.where(_.url eqs ?).modify(_.props putAll ?).prepareAsync() val operation = for { - insertDone <- database.recipes.store(recipe).future() - update <- updateQuery.flatMap(_.bind(mapItems, recipe.url).future()) + _ <- database.recipes.store(recipe).future() + _ <- updateQuery.flatMap(_.bind(mapItems, recipe.url).future()) select <- database.recipes.select(_.props).where(_.url eqs recipe.url).one } yield select @@ -124,8 +124,8 @@ class MapOperationsTest extends PhantomSuite { val postRemove = recipe.props - removals val operation = for { - insertDone <- database.recipes.store(recipe).future() - update <- database.recipes.update + _ <- database.recipes.store(recipe).future() + _ <- database.recipes.update .where(_.url eqs recipe.url) .modify(_.props - removals) .future() @@ -145,8 +145,8 @@ class MapOperationsTest extends PhantomSuite { } val operation = for { - insertDone <- database.recipes.store(recipe).future() - update <- database.recipes.update + _ <- database.recipes.store(recipe).future() + _ <- database.recipes.update .where(_.url eqs recipe.url) .modify(_.props - removals) .future() @@ -162,13 +162,11 @@ class MapOperationsTest extends PhantomSuite { val event = gen[SampleEvent] val chain = for { - store <- database.events.store(event).future() - get <- database.events.findById(event.id) - } yield get + _ <- database.events.store(event).future() + res <- database.events.findById(event.id) + } yield res - whenReady(chain) { - res => res.value shouldEqual event - } + whenReady(chain) { res => res.value shouldEqual event } } it should "allow storing maps that use Scala primitives who do not have a TypeCodec" in { @@ -182,9 +180,9 @@ class MapOperationsTest extends PhantomSuite { ) val chain = for { - store <- database.scalaPrimitivesTable.store(sample).future() - get <- database.scalaPrimitivesTable.findById(sample.id) - } yield get + _ <- database.scalaPrimitivesTable.store(sample).future() + res <- database.scalaPrimitivesTable.findById(sample.id) + } yield res whenReady(chain) { res => res.value shouldEqual sample @@ -206,14 +204,14 @@ class MapOperationsTest extends PhantomSuite { ) val chain = for { - store <- database.scalaPrimitivesTable.store(sample).future() - get <- database.scalaPrimitivesTable.findById(sample.id) - update <- database.scalaPrimitivesTable.update + _ <- database.scalaPrimitivesTable.store(sample).future() + res <- database.scalaPrimitivesTable.findById(sample.id) + _ <- database.scalaPrimitivesTable.update .where(_.id eqs sample.id) .modify(_.map(updateKey) setTo BigDecimal(updatedValue)) .future() - get2 <- database.scalaPrimitivesTable.findById(sample.id) - } yield (get, get2) + res2 <- database.scalaPrimitivesTable.findById(sample.id) + } yield (res, res2) whenReady(chain) { case (beforeUpdate, afterUpdate) => beforeUpdate.value shouldEqual sample diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectJsonTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectJsonTest.scala index 654d1f6f6..3d19bf50a 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectJsonTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectJsonTest.scala @@ -34,7 +34,7 @@ class SelectJsonTest extends PhantomSuite { val row = gen[PrimitiveRecord] val chain = for { - store <- database.primitives.store(row).future() + _ <- database.primitives.store(row).future() b <- database.primitives.select.json().where(_.pkey eqs row.pkey).one } yield b @@ -56,7 +56,7 @@ class SelectJsonTest extends PhantomSuite { val expected = row.take(Nat._8) val chain = for { - store <- database.primitives.store(row).future() + _ <- database.primitives.store(row).future() one <- database.primitives.select(_.pkey, _.long, _.boolean, _.bDecimal, _.double, _.float, _.inet, _.int) .json() .where(_.pkey eqs row.pkey).one() diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectTest.scala index 09d1f493d..d44d1f5d8 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/SelectTest.scala @@ -19,6 +19,7 @@ import com.outworkers.phantom.PhantomSuite import com.outworkers.phantom.builder.query.bugs.UserSchema import com.outworkers.phantom.dsl._ import com.outworkers.phantom.tables._ +import com.outworkers.phantom.tables.bugs.TokenRecord import com.outworkers.util.samplers._ class SelectTest extends PhantomSuite { @@ -27,6 +28,7 @@ class SelectTest extends PhantomSuite { super.beforeAll() val _ = database.primitives.createSchema() database.userSchema.createSchema() + database.tokensTable.createSchema() } "Selecting the whole row" should "work fine" in { @@ -70,4 +72,21 @@ class SelectTest extends PhantomSuite { res.value shouldEqual row.id } } + + it should "allowFiltering on partition key columns with Cassandra 3.10+" in { + if (cassandraVersion.value > Version.`3.10.0`) { + + val counter = gen[Int] + val rows = genList[TokenRecord]().map(_.copy(counter = counter)) + + val chain = for { + _ <- database.tokensTable.storeRecords(rows) + res <- database.tokensTable.expired(counter) + } yield res + + whenReady(chain) { res => + res should contain allElementsOf rows + } + } + } } diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/TruncateTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/TruncateTest.scala index 948e119d1..728d27f32 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/TruncateTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/crud/TruncateTest.scala @@ -31,10 +31,10 @@ class TruncateTest extends PhantomSuite { val articles = genList[Article]() val result = for { - truncateBefore <- database.articles.truncate.future() - store <- database.articles.storeRecords(articles) + _ <- database.articles.truncate.future() + _ <- database.articles.storeRecords(articles) records <- database.articles.select.fetch - truncate <- database.articles.truncate.future() + _ <- database.articles.truncate.future() records1 <- database.articles.select.fetch } yield (records, records1) @@ -52,10 +52,10 @@ class TruncateTest extends PhantomSuite { val articles = genList[Article]() val result = for { - truncateBefore <- database.articles.truncate.future() - i1 <- database.articles.storeRecords(articles) + _ <- database.articles.truncate.future() + _ <- database.articles.storeRecords(articles) records <- database.articles.select.fetch - truncate <- database.articles.truncate.consistencyLevel_=(ConsistencyLevel.ONE).future() + _ <- database.articles.truncate.consistencyLevel_=(ConsistencyLevel.ONE).future() records1 <- database.articles.select.fetch } yield (records, records1) diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/ConditionalQueriesTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/ConditionalQueriesTest.scala index 0afe6408f..2971ef90c 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/ConditionalQueriesTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/ConditionalQueriesTest.scala @@ -33,9 +33,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.description is recipe.description).future() select2 <- database.recipes.select.where(_.url eqs recipe.url).one() @@ -62,9 +62,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.ingredients is recipe.ingredients).future() select2 <- database.recipes.select.where(_.url eqs recipe.url).one() @@ -91,9 +91,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.ingredients is invalidMatch).future() select2 <- database.recipes.select.where(_.url eqs recipe.url).one() @@ -120,9 +120,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.description is updated).future() select2 <- database.recipes.select.where(_.url eqs recipe.url).one() @@ -150,9 +150,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.description is recipe.description) .and(_.uid is recipe.uid).future() @@ -182,9 +182,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.description is recipe.description) .and(_.lastcheckedat is recipe.lastCheckedAt) @@ -213,9 +213,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.props is recipe.props) .and(_.ingredients is recipe.ingredients) @@ -244,9 +244,9 @@ class ConditionalQueriesTest extends PhantomSuite { val updated = genOpt[String] val chain = for { - insert <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select1 <- database.recipes.select.where(_.url eqs recipe.url).one() - update <- database.recipes.update.where(_.url eqs recipe.url) + _ <- database.recipes.update.where(_.url eqs recipe.url) .modify(_.description setTo updated) .onlyIf(_.props is recipe.props) .and(_.uid is recipe.uid) diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/InOperatorTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/InOperatorTest.scala index 7bffbdb2e..775db58d3 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/InOperatorTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/InOperatorTest.scala @@ -31,7 +31,7 @@ class InOperatorTest extends PhantomSuite { val recipe = gen[Recipe] val chain = for { - done <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select <- database.recipes.select.where(_.url in List(recipe.url, gen[EmailAddress].value)).one() } yield select @@ -44,7 +44,7 @@ class InOperatorTest extends PhantomSuite { val recipe = gen[Recipe] val chain = for { - done <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() selectIn <- database.recipes.select.where(_.url in ?).prepareAsync() bindedIn <- selectIn.bind(ListValue(recipe.url, gen[ShortString].value)).one() } yield bindedIn @@ -58,7 +58,7 @@ class InOperatorTest extends PhantomSuite { val recipe = gen[Recipe] val chain = for { - done <- database.recipes.store(recipe).future() + _ <- database.recipes.store(recipe).future() select <- database.recipes.select.where(_.url in List(gen[EmailAddress].value)).one() } yield select diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/IndexedCollectionsTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/IndexedCollectionsTest.scala index fd71d4c77..64a184794 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/IndexedCollectionsTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/IndexedCollectionsTest.scala @@ -38,7 +38,7 @@ class IndexedCollectionsTest extends PhantomSuite { val record = gen[TestRow] val chain = for { - store <- database.indexedCollectionsTable.store(record).future() + _ <- database.indexedCollectionsTable.store(record).future() one <- database.indexedCollectionsTable.select .where(_.setText contains record.setText.headOption.value) .fetch() @@ -64,7 +64,7 @@ class IndexedCollectionsTest extends PhantomSuite { .prepareAsync() val chain = for { - store <- database.indexedCollectionsTable.store(record).future() + _ <- database.indexedCollectionsTable.store(record).future() prep <- query list <- prep.bind(record.setText.headOption.value).fetch() } yield list @@ -86,7 +86,7 @@ class IndexedCollectionsTest extends PhantomSuite { val record = gen[TestRow] val chain = for { - store <- database.indexedCollectionsTable.store(record).future() + _ <- database.indexedCollectionsTable.store(record).future() one <- database.indexedCollectionsTable.select .where(_.mapTextToText contains record.mapTextToText.values.headOption.value) .fetch() @@ -112,7 +112,7 @@ class IndexedCollectionsTest extends PhantomSuite { .prepareAsync() val chain = for { - store <- database.indexedCollectionsTable.store(record).future() + _ <- database.indexedCollectionsTable.store(record).future() results <- query.flatMap(_.bind(record.mapTextToText.values.headOption.value).fetch()) } yield results @@ -130,7 +130,7 @@ class IndexedCollectionsTest extends PhantomSuite { val record = gen[TestRow] val chain = for { - store <- database.indexedCollectionsTable.store(record).future() + _ <- database.indexedCollectionsTable.store(record).future() get <- database.indexedCollectionsTable .select .where(_.mapIntToText containsKey record.mapIntToText.keys.headOption.value) @@ -153,7 +153,7 @@ class IndexedCollectionsTest extends PhantomSuite { val record = gen[TestRow] val chain = for { - store <- database.indexedCollectionsTable.store(record).future() + _ <- database.indexedCollectionsTable.store(record).future() get <- database.indexedCollectionsTable .select .where(_.mapIntToText containsKey ?) @@ -177,7 +177,7 @@ class IndexedCollectionsTest extends PhantomSuite { val record = gen[TestRow].copy(mapIntToInt = Map(5 -> 10, 10 -> 15, 20 -> 25)) val chain = for { - store <- database.indexedEntriesTable.store(record).future() + _ <- database.indexedEntriesTable.store(record).future() result <- database.indexedEntriesTable.select.where(_.mapIntToInt(20) eqs 25).fetch() } yield result @@ -199,7 +199,7 @@ class IndexedCollectionsTest extends PhantomSuite { val query = database.indexedEntriesTable.select.where(_.mapIntToInt(20) eqs ?).prepareAsync() val chain = for { - store <- database.indexedEntriesTable.store(record).future() + _ <- database.indexedEntriesTable.store(record).future() result <- query.flatMap(_.bind(25).fetch()) } yield result diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JodaDateTimeColumnTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JodaDateTimeColumnTest.scala index 6a606e274..9813156ba 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JodaDateTimeColumnTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JodaDateTimeColumnTest.scala @@ -31,7 +31,7 @@ class JodaDateTimeColumnTest extends PhantomSuite { val row = gen[JodaRow] val chain = for { - store <- database.primitivesJoda.store(row).future() + _ <- database.primitivesJoda.store(row).future() select <- database.primitivesJoda.select.where(_.pkey eqs row.pkey).one() } yield select diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JsonColumnTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JsonColumnTest.scala index 80be36fa1..f64eeda6f 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JsonColumnTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/JsonColumnTest.scala @@ -31,7 +31,7 @@ class JsonColumnTest extends PhantomSuite { val sample = gen[JsonClass] val chain = for { - done <- database.jsonTable.store(sample).future() + _ <- database.jsonTable.store(sample).future() select <- database.jsonTable.select.where(_.id eqs sample.id).one } yield select @@ -45,9 +45,9 @@ class JsonColumnTest extends PhantomSuite { val sample2 = gen[JsonClass] val chain = for { - done <- database.jsonTable.store(sample).future() + _ <- database.jsonTable.store(sample).future() select <- database.jsonTable.select.where(_.id eqs sample.id).one - update <- database.jsonTable.update.where(_.id eqs sample.id).modify(_.json setTo sample2.json).future() + _ <- database.jsonTable.update.where(_.id eqs sample.id).modify(_.json setTo sample2.json).future() select2 <- database.jsonTable.select.where(_.id eqs sample.id).one() } yield (select, select2) @@ -62,7 +62,7 @@ class JsonColumnTest extends PhantomSuite { val updated = genOpt[JsonTest] val chain = for { - done <- database.jsonTable.store(sample).future() + _ <- database.jsonTable.store(sample).future() select <- database.jsonTable.select.where(_.id eqs sample.id).one _ <- database.jsonTable.update .where(_.id eqs sample.id) @@ -82,9 +82,9 @@ class JsonColumnTest extends PhantomSuite { val sample2 = gen[JsonClass] val chain = for { - done <- database.jsonTable.store(sample).future() + _ <- database.jsonTable.store(sample).future() select <- database.jsonTable.select.where(_.id eqs sample.id).one - update <- database.jsonTable.update.where(_.id eqs sample.id) + _ <- database.jsonTable.update.where(_.id eqs sample.id) .modify(_.jsonList setIdx (0, sample2.json) ).future() select2 <- database.jsonTable.select.where(_.id eqs sample.id).one() } yield (select, select2) @@ -100,9 +100,9 @@ class JsonColumnTest extends PhantomSuite { val sample2 = gen[JsonClass] val chain = for { - done <- database.jsonTable.store(sample).future() + _ <- database.jsonTable.store(sample).future() select <- database.jsonTable.select.where(_.id eqs sample.id).one - update <- database.jsonTable.update.where(_.id eqs sample.id).modify(_.jsonSet add sample2.json).future() + _ <- database.jsonTable.update.where(_.id eqs sample.id).modify(_.jsonSet add sample2.json).future() select2 <- database.jsonTable.select.where(_.id eqs sample.id).one() } yield (select, select2) diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/OptionalIndexesTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/OptionalIndexesTest.scala index 87103698c..517352b15 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/OptionalIndexesTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/OptionalIndexesTest.scala @@ -32,7 +32,7 @@ class OptionalIndexesTest extends PhantomSuite { val sample = gen[OptionalSecondaryRecord].copy(secondary = Some(gen[Int])) val chain = for { - store <- database.optionalIndexesTable.store(sample).future() + _ <- database.optionalIndexesTable.store(sample).future() select <- database.optionalIndexesTable.findById(sample.id) select2 <- database.optionalIndexesTable.findByOptionalSecondary(sample.secondary.value) } yield (select, select2) @@ -50,9 +50,9 @@ class OptionalIndexesTest extends PhantomSuite { val sample = gen[OptionalSecondaryRecord].copy(secondary = Some(gen[Int])) val chain = for { - store <- database.optionalIndexesTable.store(sample).future() + _ <- database.optionalIndexesTable.store(sample).future() select <- database.optionalIndexesTable.findByOptionalSecondary(sample.secondary.value) - delete <- database.optionalIndexesTable.delete.where(_.secondary eqs sample.secondary.value).future() + _ <- database.optionalIndexesTable.delete.where(_.secondary eqs sample.secondary.value).future() select2 <- database.optionalIndexesTable.findByOptionalSecondary(sample.secondary.value) } yield (select, select2) diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/SecondaryIndexTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/SecondaryIndexTest.scala index 23354d54d..38bffbb34 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/SecondaryIndexTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/SecondaryIndexTest.scala @@ -132,8 +132,8 @@ class SecondaryIndexTest extends PhantomSuite { val sample = gen[SecondaryIndexRecord] val chain = for { - create <- database.quotedSecondaryIndexTable.create.ifNotExists().future() - insert <- database.quotedSecondaryIndexTable.storeRecord(sample) + _ <- database.quotedSecondaryIndexTable.create.ifNotExists().future() + _ <- database.quotedSecondaryIndexTable.storeRecord(sample) query <- database.quotedSecondaryIndexTable.select.where(_.secondary eqs sample.secondary).one() } yield query diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/TupleColumnTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/TupleColumnTest.scala index 0321e1504..77d636d5a 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/TupleColumnTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/db/specialized/TupleColumnTest.scala @@ -36,7 +36,7 @@ class TupleColumnTest extends PhantomSuite { val insert = database.tuple2Table.store(sample) val chain = for { - store <- insert.future() + _ <- insert.future() rec <- database.tuple2Table.findById(sample.id) } yield rec @@ -53,9 +53,9 @@ class TupleColumnTest extends PhantomSuite { val insert = database.tuple2Table.store(sample) val chain = for { - store <- insert.future() + _ <- insert.future() rec <- database.tuple2Table.findById(sample.id) - update <- database.tuple2Table.update.where(_.id eqs sample.id).modify(_.tp setTo sample2.tp).future() + _ <- database.tuple2Table.update.where(_.id eqs sample.id).modify(_.tp setTo sample2.tp).future() rec2 <- database.tuple2Table.findById(sample.id) } yield (rec, rec2) @@ -74,7 +74,7 @@ class TupleColumnTest extends PhantomSuite { val insert = database.nestedTupleTable.store(sample) val chain = for { - store <- insert.future() + _ <- insert.future() rec <- database.nestedTupleTable.findById(sample.id) } yield rec @@ -91,9 +91,9 @@ class TupleColumnTest extends PhantomSuite { val insert = database.nestedTupleTable.store(sample) val chain = for { - store <- insert.future() + _ <- insert.future() rec <- database.nestedTupleTable.findById(sample.id) - update <- database.nestedTupleTable.update + _ <- database.nestedTupleTable.update .where(_.id eqs sample.id) .modify(_.tp setTo sample2.tp) .future() @@ -116,7 +116,7 @@ class TupleColumnTest extends PhantomSuite { val insert = database.tupleCollectionsTable.store(sample) val chain = for { - store <- insert.future() + _ <- insert.future() rec <- database.tupleCollectionsTable.findById(sample.id) } yield rec @@ -133,9 +133,9 @@ class TupleColumnTest extends PhantomSuite { val appended = gen[Int] -> gen[String] val chain = for { - store <- database.tupleCollectionsTable.store(sample).future() + _ <- database.tupleCollectionsTable.store(sample).future() rec <- database.tupleCollectionsTable.findById(sample.id) - update <- database.tupleCollectionsTable.update + _ <- database.tupleCollectionsTable.update .where(_.id eqs sample.id) .modify(_.tuples append appended) .future() @@ -156,7 +156,7 @@ class TupleColumnTest extends PhantomSuite { val sample = gen[TuplePartitionRecord] val chain = for { - store <- database.tuplePartitionKeyTable.store(sample).future + _ <- database.tuplePartitionKeyTable.store(sample).future rec <- database.tuplePartitionKeyTable.select.where(_.id eqs sample.id).one() } yield rec @@ -171,9 +171,9 @@ class TupleColumnTest extends PhantomSuite { val newUuid = gen[UUID] val chain = for { - store <- database.tuplePartitionKeyTable.store(sample).future + _ <- database.tuplePartitionKeyTable.store(sample).future rec <- database.tuplePartitionKeyTable.select.where(_.id eqs sample.id).one() - updateRec <- database.tuplePartitionKeyTable.update + _ <- database.tuplePartitionKeyTable.update .where(_.id eqs sample.id) .modify(_.rec setTo newUuid) .future() diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/ExactlyOncePromiseTests.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/ExactlyOncePromiseTests.scala index f4d8e4293..8c542df72 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/ExactlyOncePromiseTests.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/ExactlyOncePromiseTests.scala @@ -32,9 +32,9 @@ class ExactlyOncePromiseTests extends FlatSpec with Matchers with ScalaFutures { val promise = new ExactlyOncePromise(Future(atomic.incrementAndGet())) val chain = for { - one <- promise.future - two <- promise.future - three <- promise.future + _ <- promise.future + _ <- promise.future + _ <- promise.future four <- promise.future } yield four diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/JsonPreparedInserts.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/JsonPreparedInserts.scala index 32a96d718..02f5105b2 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/JsonPreparedInserts.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/JsonPreparedInserts.scala @@ -31,7 +31,7 @@ class JsonPreparedInserts extends PhantomSuite { val sample = gen[NestedJsonRecord] val chain = for { - insert <- database.jsonPreparedTable.insertItem(sample) + _ <- database.jsonPreparedTable.insertItem(sample) one <- database.jsonPreparedTable.findById(sample.id) } yield one @@ -45,7 +45,7 @@ class JsonPreparedInserts extends PhantomSuite { val sample = gen[NestedJsonRecord] val chain = for { - insert <- database.jsonPreparedTable.storeRecord(sample) + _ <- database.jsonPreparedTable.storeRecord(sample) one <- database.jsonPreparedTable.findById(sample.id) } yield one diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedInsertQueryTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedInsertQueryTest.scala index c9fdaf7c1..bf9cd50e6 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedInsertQueryTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedInsertQueryTest.scala @@ -73,7 +73,7 @@ class PreparedInsertQueryTest extends PhantomSuite { .p_value(_.props, ?) .p_value(_.uid, ?) .prepareAsync() - store <- query.bind(sample).future() + _ <- query.bind(sample).future() get <- database.recipes.select.where(_.url eqs sample.url).one() } yield get @@ -134,7 +134,7 @@ class PreparedInsertQueryTest extends PhantomSuite { .prepare() val chain = for { - store <- query.bind(sample).future() + _ <- query.bind(sample).future() get <- database.primitives.select.where(_.pkey eqs sample.pkey).one() } yield get @@ -160,7 +160,7 @@ class PreparedInsertQueryTest extends PhantomSuite { .prepare() val chain = for { - store <- query.bind(sample).future() + _ <- query.bind(sample).future() res <- selectQuery.bind(sample.pkey).one() } yield res @@ -199,7 +199,7 @@ class PreparedInsertQueryTest extends PhantomSuite { ) val chain = for { - store <- exec.future() + _ <- exec.future() res <- database.recipes.select.where(_.url eqs sample.url).one() } yield res @@ -225,7 +225,7 @@ class PreparedInsertQueryTest extends PhantomSuite { .prepare() val chain = for { - store <- query.bind(sample).future() + _ <- query.bind(sample).future() res <- database.derivedPrimitivesTable.select.where(_.id eqs sample.id).one() } yield res @@ -249,7 +249,7 @@ class PreparedInsertQueryTest extends PhantomSuite { .p_value(_.rec, ?) .p_value(_.complex, ?) .prepareAsync() - store <- query.bind(sample).future() + _ <- query.bind(sample).future() res <- database.derivedPrimitivesTable.select.where(_.id eqs sample.id).one() } yield res @@ -278,7 +278,7 @@ class PreparedInsertQueryTest extends PhantomSuite { .prepare() val chain = for { - store <- query.bind(sample).future() + _ <- query.bind(sample).future() res <- database.primitives.select.where(_.pkey eqs sample.pkey).one() } yield res @@ -306,7 +306,7 @@ class PreparedInsertQueryTest extends PhantomSuite { .p_value(_.bi, ?) .p_value(_.ascii, ?) .prepareAsync() - store <- query.bind(sample).future() + _ <- query.bind(sample).future() res <- database.primitives.select.where(_.pkey eqs sample.pkey).one() } yield res diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedUpdateQueryTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedUpdateQueryTest.scala index 954b73ba8..4b0bb907a 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedUpdateQueryTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/query/prepared/PreparedUpdateQueryTest.scala @@ -182,7 +182,7 @@ class PreparedUpdateQueryTest extends PhantomSuite { res <- db.verizonSchema.select.where(_.uid eqs sample.uid).one() } yield (updated, res) - whenReady(chain) { case (updated, res) => + whenReady(chain) { case (_, res) => res shouldBe defined res.value.isDeleted shouldBe false } diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/serializers/InsertQuerySerializationTest.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/serializers/InsertQuerySerializationTest.scala index 0e0b1460c..1e106513f 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/serializers/InsertQuerySerializationTest.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/builder/serializers/InsertQuerySerializationTest.scala @@ -111,6 +111,8 @@ class InsertQuerySerializationTest extends QueryBuilderTest { val sample = gen[Recipe] val json = compactJson(renderJValue(Extraction.decompose(sample))) val query = TestDatabase.recipes.insert.json(json).queryString + + query shouldEqual query } "should append USING clause after lightweight part " in { diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TableHelperRuntimeTests.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TableHelperRuntimeTests.scala index f367d87db..1b8268b3a 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TableHelperRuntimeTests.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TableHelperRuntimeTests.scala @@ -34,7 +34,7 @@ class TableHelperRuntimeTests extends PhantomSuite { val (id, _, _) = sample val chain = for { - store <- database.tableTypeTuple.store(sample).future() + _ <- database.tableTypeTuple.store(sample).future() find <- database.tableTypeTuple.findById(id) } yield find @@ -48,7 +48,7 @@ class TableHelperRuntimeTests extends PhantomSuite { val sample = gen[OAuth2Session] val chain = for { - store <- database.sessionsByUser.store(sample).future() + _ <- database.sessionsByUser.store(sample).future() find <- database.sessionsByUser.select.where(_.user_id eqs sample.user_id).one() } yield find diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TestDatabase.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TestDatabase.scala index 7b9cdedfb..b327b628f 100644 --- a/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TestDatabase.scala +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/TestDatabase.scala @@ -47,6 +47,7 @@ class TestDatabase( object secondaryCounterTable extends SecondaryCounterTable with Connector object brokenCounterCounterTable extends BrokenCounterTableTest with Connector + object tokensTable extends TokensTable with Connector object collectionNpeTable extends PrimitiveColumnRecipes with Connector object indexedCollectionsTable extends IndexedCollectionsTable with Connector object indexedEntriesTable extends IndexedEntriesTable with Connector @@ -130,4 +131,4 @@ object Connector { ) } -object TestDatabase extends TestDatabase(Connector.default) \ No newline at end of file +object TestDatabase extends TestDatabase(Connector.default) diff --git a/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/bugs/NonIndexQueryColumns.scala b/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/bugs/NonIndexQueryColumns.scala new file mode 100644 index 000000000..c8a22099d --- /dev/null +++ b/phantom-dsl/src/test/scala/com/outworkers/phantom/tables/bugs/NonIndexQueryColumns.scala @@ -0,0 +1,53 @@ +/* + * Copyright 2013 - 2019 Outworkers Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.outworkers.phantom.tables.bugs + +import com.outworkers.phantom.dsl._ + +import scala.concurrent.Future + +final case class TokenRecord( + email: String, + token: UUID, + counter: Int +) + +abstract class TokensTable extends Table[TokensTable, TokenRecord] { + object email extends StringColumn + object token extends UUIDColumn with PartitionKey { + override val name = "tokenuid" + } + object counter extends IntColumn + + def findById(id: UUID): Future[Option[TokenRecord]] = { + select.where( _.token eqs id).one() + } + + def deleteById(id: UUID) : Future[ResultSet] = { + delete.where( _.token eqs id).future() + } + + def expired(counter: Int): Future[List[TokenRecord]] = { + + /* PHANTOM NOT IMPLEMENTED FEATURE: + * With "allow filtering" Cassandra allows to query + * non indexed column. Restrictions are on querying part of multi column + * partition key. You need Cassandra 3.10+ to be able to filter + * on partition key columns. + */ + select.where(_.counter gte counter).allowFiltering().fetch() + } +} \ No newline at end of file diff --git a/phantom-thrift/src/test/scala/com/outworkers/phantom/thrift/tests/binary/suites/ThriftMapColumnTest.scala b/phantom-thrift/src/test/scala/com/outworkers/phantom/thrift/tests/binary/suites/ThriftMapColumnTest.scala index 01c692f67..400a46269 100644 --- a/phantom-thrift/src/test/scala/com/outworkers/phantom/thrift/tests/binary/suites/ThriftMapColumnTest.scala +++ b/phantom-thrift/src/test/scala/com/outworkers/phantom/thrift/tests/binary/suites/ThriftMapColumnTest.scala @@ -67,8 +67,8 @@ class ThriftMapColumnTest extends BinarySuite { val expected = sample.thriftMap ++ toAdd val operation = for { - insertDone <- thriftDb.thriftColumnTable.store(sample).future - update <- thriftDb.thriftColumnTable.update + _ <- thriftDb.thriftColumnTable.store(sample).future + _ <- thriftDb.thriftColumnTable.update .where(_.id eqs sample.id) .modify(_.thriftMap putAll toAdd).future() select <- thriftDb.thriftColumnTable @@ -91,8 +91,8 @@ class ThriftMapColumnTest extends BinarySuite { val expected = sample.thriftMap ++ toAdd val operation = for { - insertDone <- thriftDb.thriftColumnTable.store(sample).future() - update <- thriftDb.thriftColumnTable.update.where(_.id eqs sample.id).modify(_.thriftMap putAll toAdd).future() + _ <- thriftDb.thriftColumnTable.store(sample).future() + _ <- thriftDb.thriftColumnTable.update.where(_.id eqs sample.id).modify(_.thriftMap putAll toAdd).future() select <- thriftDb.thriftColumnTable.select(_.thriftMap).where(_.id eqs sample.id).one } yield select