DB insert/update rows from file, query dates from months
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user