DBService object to class with logger injection

This commit is contained in:
Guntis Smaukstelis
2023-05-20 20:20:14 +03:00
parent 9241277b7f
commit bbdfaa06d8
6 changed files with 43 additions and 27 deletions
+3 -1
View File
@@ -2,6 +2,7 @@ package parse
import cats.effect.IO
import cats.effect.unsafe.implicits.global
import db.DBService
import io.circe.syntax.EncoderOps
import parse.Aggregate.AggregateValueImplicits.aggregateValueEncoder
import parse.Aggregate.{AggregateKey, UserQuery}
@@ -19,7 +20,8 @@ object Main {
val userQuery = UserQuery(List("Rīga"), "tempAvg", AggregateKey.List)
for {
lines <- db.DBService.getInRange(from, to)
dbService <- DBService.of
lines <- dbService.getInRange(from, to)
parsed <- IO.pure(Parser.queryData(userQuery, lines))
_ <- IO.println(parsed.asJson)
} yield ()