Skip to content

Commit

Permalink
Merge pull request #459 from eikek/update-dependencies
Browse files Browse the repository at this point in the history
Update doobie, fs2 and scala
  • Loading branch information
mergify[bot] authored Aug 3, 2023
2 parents 0f46aa0 + f123e48 commit 09870be
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ For more information see
man systemd.time
```

or

<https://man.cx/systemd.time#heading7>


## Limitations

This library has some limitations when parsing calendar events
Expand Down Expand Up @@ -164,16 +169,16 @@ import java.time._
ce.asString
// res4: String = "*-*-* 00/2:00:00"
val now = LocalDateTime.now
// now: LocalDateTime = 2022-03-11T21:47:18.418490
// now: LocalDateTime = 2023-08-03T11:30:20.371144744
ce.nextElapse(now)
// res5: Option[LocalDateTime] = Some(value = 2022-03-11T22:00)
// res5: Option[LocalDateTime] = Some(value = 2023-08-03T12:00)
ce.nextElapses(now, 5)
// res6: List[LocalDateTime] = List(
// 2022-03-11T22:00,
// 2022-03-12T00:00,
// 2022-03-12T02:00,
// 2022-03-12T04:00,
// 2022-03-12T06:00
// 2023-08-03T12:00,
// 2023-08-03T14:00,
// 2023-08-03T16:00,
// 2023-08-03T18:00,
// 2023-08-03T20:00
// )
```

Expand Down Expand Up @@ -210,19 +215,19 @@ val everyTwoSeconds = CalEvent.unsafe("*-*-* *:*:0/2")
// zone = None
// )
val scheduler = Scheduler.systemDefault[IO]
// scheduler: Scheduler[IO] = com.github.eikek.calev.fs2.Scheduler$$anon$1@60877629
// scheduler: Scheduler[IO] = com.github.eikek.calev.fs2.Scheduler$$anon$1@331b0bfd

val printTime = Stream.eval(IO(println(LocalTime.now)))
// printTime: Stream[IO, Unit] = Stream(..)

val task = scheduler.awakeEvery(everyTwoSeconds) >> printTime
// task: Stream[IO[x], Unit] = Stream(..)
// task: Stream[[x]IO[x], Unit] = Stream(..)

import cats.effect.unsafe.implicits._
task.take(3).compile.drain.unsafeRunSync()
// 21:47:20.018387
// 21:47:22.001942
// 21:47:24.002348
// 11:30:22.007430655
// 11:30:24.000809249
// 11:30:26.001204345
```


Expand Down Expand Up @@ -257,15 +262,15 @@ val insert =
sql"INSERT INTO mytable (event) VALUES (${r.event})".update.run
// insert: ConnectionIO[Int] = Suspend(
// a = Uncancelable(
// body = cats.effect.kernel.MonadCancel$$Lambda$2138/0x0000000800c18040@48d44acf
// body = cats.effect.kernel.MonadCancel$$Lambda$2205/0x000000080185f8a0@7f6c85c4
// )
// )

val select =
sql"SELECT event FROM mytable WHERE id = 1".query[Record].unique
// select: ConnectionIO[Record] = Suspend(
// a = Uncancelable(
// body = cats.effect.kernel.MonadCancel$$Lambda$2138/0x0000000800c18040@49f2994f
// body = cats.effect.kernel.MonadCancel$$Lambda$2205/0x000000080185f8a0@319c77de
// )
// )
```
Expand Down Expand Up @@ -355,7 +360,7 @@ val jackson = JsonMapper
.builder()
.addModule(new CalevModule())
.build()
// jackson: JsonMapper = com.fasterxml.jackson.databind.json.JsonMapper@2a654f27
// jackson: JsonMapper = com.fasterxml.jackson.databind.json.JsonMapper@12dcfa6a

val myEvent = CalEvent.unsafe("Mon *-*-* 05:00/10:00")
// myEvent: CalEvent = CalEvent(
Expand Down Expand Up @@ -477,7 +482,7 @@ calevScheduler().scheduleOnceWithCalendarEvent(calEvent, () => {
)
})
// res11: Option[<none>.<root>.akka.actor.Cancellable] = Some(
// value = akka.actor.LightArrayRevolverScheduler$TaskHolder@5b7f9eaa
// value = akka.actor.LightArrayRevolverScheduler$TaskHolder@57b4fc1e
// )
system.terminate()
```
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import com.github.sbt.git.SbtGit.GitKeys

val scala212 = "2.12.18"
val scala213 = "2.13.11"
val scala3 = "3.2.2"
val scala3 = "3.3.0"

val updateReadme = inputKey[Unit]("Update readme")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import munit._
class CalevDoobieTest extends FunSuite with CalevDoobieMeta {

val xa = Transactor.fromDriverManager[IO](
"org.h2.Driver",
"jdbc:h2:mem:testing;DB_CLOSE_DELAY=-1",
"sa",
""
driver = "org.h2.Driver",
url = "jdbc:h2:mem:testing;DB_CLOSE_DELAY=-1",
user = "sa",
password = "",
logHandler = None
)

case class Record(event: CalEvent)
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ object Dependencies {

val akkaVersion = "2.6.20"
val circeVersion = "0.14.5"
val doobieVersion = "1.0.0-RC2"
val fs2Version = "3.7.0"
val doobieVersion = "1.0.0-RC4"
val fs2Version = "3.8.0"
val h2Version = "2.2.220"
val jacksonVersion = "2.15.2"
val log4sVersion = "1.8.2"
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.2")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.3")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
Expand Down

0 comments on commit 09870be

Please sign in to comment.