Skip to content

Commit c88f51c

Browse files
committed
Changed the type of Cassandra timestamps from Int to Long (#3397)
1 parent 5a5b8ae commit c88f51c

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

quill-cassandra/src/main/scala/io/getquill/context/cassandra/Ops.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ trait Ops {
77
this: CassandraContext[_] =>
88

99
abstract class Options[A](q: A) {
10-
def usingTimestamp(ts: Int) = quote(sql"$q USING TIMESTAMP $ts".as[A])
11-
def usingTtl(ttl: Int) = quote(sql"$q USING TTL $ttl".as[A])
12-
def using(ts: Int, ttl: Int) = quote(sql"$q USING TIMESTAMP $ts AND TTL $ttl".as[A])
10+
def usingTimestamp(ts: Long) = quote(sql"$q USING TIMESTAMP $ts".as[A])
11+
def usingTtl(ttl: Int) = quote(sql"$q USING TTL $ttl".as[A])
12+
def using(ts: Long, ttl: Int) = quote(sql"$q USING TIMESTAMP $ts AND TTL $ttl".as[A])
1313
}
1414

1515
implicit final class QueryOps[Q <: Query[_]](q: Q) {

quill-cassandra/src/test/scala/io/getquill/context/cassandra/ops/CassandraOpsSpec.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class CassandraOpsSpec extends Spec {
2929
"options" - {
3030
"timestamp" in {
3131
val q = quote {
32-
query[TestEntity].insert(_.s -> "s").usingTimestamp(1)
32+
query[TestEntity].insert(_.s -> "s").usingTimestamp(Long.MaxValue)
3333
}
3434
mirrorContext.run(q).string mustEqual
35-
"INSERT INTO TestEntity (s) VALUES ('s') USING TIMESTAMP 1"
35+
"INSERT INTO TestEntity (s) VALUES ('s') USING TIMESTAMP 9223372036854775807"
3636
}
3737
"ttl" in {
3838
val q = quote {
@@ -43,10 +43,10 @@ class CassandraOpsSpec extends Spec {
4343
}
4444
"both" in {
4545
val q = quote {
46-
query[TestEntity].insert(_.s -> "s").using(1, 2)
46+
query[TestEntity].insert(_.s -> "s").using(Long.MaxValue, 2)
4747
}
4848
mirrorContext.run(q).string mustEqual
49-
"INSERT INTO TestEntity (s) VALUES ('s') USING TIMESTAMP 1 AND TTL 2"
49+
"INSERT INTO TestEntity (s) VALUES ('s') USING TIMESTAMP 9223372036854775807 AND TTL 2"
5050
}
5151
}
5252
}
@@ -55,10 +55,10 @@ class CassandraOpsSpec extends Spec {
5555
"options" - {
5656
"timestamp" in {
5757
val q = quote {
58-
query[TestEntity].usingTimestamp(99).updateValue(lift(TestEntity("s", 1, 2L, None, true)))
58+
query[TestEntity].usingTimestamp(Long.MaxValue).updateValue(lift(TestEntity("s", 1, 2L, None, true)))
5959
}
6060
mirrorContext.run(q).string mustEqual
61-
"UPDATE TestEntity USING TIMESTAMP 99 SET s = ?, i = ?, l = ?, o = ?, b = ?"
61+
"UPDATE TestEntity USING TIMESTAMP 9223372036854775807 SET s = ?, i = ?, l = ?, o = ?, b = ?"
6262
}
6363
"ttl" in {
6464
val q = quote {
@@ -69,10 +69,10 @@ class CassandraOpsSpec extends Spec {
6969
}
7070
"both" in {
7171
val q = quote {
72-
query[TestEntity].using(1, 2).updateValue(lift(TestEntity("s", 1, 2L, None, true)))
72+
query[TestEntity].using(Long.MaxValue, 2).updateValue(lift(TestEntity("s", 1, 2L, None, true)))
7373
}
7474
mirrorContext.run(q).string mustEqual
75-
"UPDATE TestEntity USING TIMESTAMP 1 AND TTL 2 SET s = ?, i = ?, l = ?, o = ?, b = ?"
75+
"UPDATE TestEntity USING TIMESTAMP 9223372036854775807 AND TTL 2 SET s = ?, i = ?, l = ?, o = ?, b = ?"
7676
}
7777
}
7878
"ifExists" in {

0 commit comments

Comments
 (0)