Changed data structure for weather params and aggregating
This commit is contained in:
@@ -3,6 +3,8 @@ package parse
|
||||
import cats.effect.IO
|
||||
import cats.effect.unsafe.implicits.global
|
||||
import io.circe.syntax.EncoderOps
|
||||
import parse.Aggregate.AggregateValueImplicits.aggregateValueEncoder
|
||||
import parse.Aggregate.{AggregateKey, UserQuery}
|
||||
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
@@ -14,11 +16,13 @@ object Main {
|
||||
val formatter = DateTimeFormatter.ofPattern("yyyyMMdd_HHmm")
|
||||
val from = LocalDateTime.parse("20230414_2200", formatter)
|
||||
val to = LocalDateTime.parse("20230501_1230", formatter)
|
||||
val userQuery = UserQuery(List("Liepāja", "Rēzekne", "randomstr"), "tempMax", AggregateKey.Max)
|
||||
|
||||
for {
|
||||
lines <- db.DBService.getInRange(from, to)
|
||||
parsed <- IO.pure(Parser.queryData(lines, List("Liepāja", "Rēzekne", "randomstr"), AggregateKey.tempMax))
|
||||
parsed <- IO.pure(Parser.queryData(userQuery, lines))
|
||||
_ <- IO.println(parsed.asJson)
|
||||
_ <- IO.println(None.asJson)
|
||||
} yield ()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user