DB insert/update rows from file, query dates from months

This commit is contained in:
Guntis Smaukstelis
2023-10-23 16:20:45 +03:00
parent aa4fa57adb
commit 47be3bf385
3 changed files with 89 additions and 23 deletions
+14 -2
View File
@@ -2,15 +2,27 @@ package app
import cats.effect._
import cats.implicits.catsSyntaxTuple2Parallel
import db.{FileService, DataService}
import db.Main.transactor
import db.{DataService, FileService, PostgresService}
import doobie.Transactor
import fetch.{FetchService, FileFetchScheduler}
import server.Server
object Main extends IOApp {
def transactor[F[_] : Async]: Transactor[F] = Transactor.fromDriverManager[F](
"org.postgresql.Driver",
"jdbc:postgresql://localhost:5432/weather-tool",
"postgres",
"mysecretpassword"
)
def run(args: List[String]): IO[ExitCode] = {
val xa = transactor[IO]
for {
postgresService <- PostgresService.of(xa)
fileService <- FileService.of
dataService <- DataService.of(fileService)
dataService <- DataService.of(fileService, postgresService)
fetch <- FetchService.of
fileFetchScheduler <- FileFetchScheduler.of(dataService, fetch)