paddockpass/main.go
2020-07-28 00:01:06 +02:00

36 lines
778 B
Go

package main
import (
"fmt"
"log"
"strconv"
"time"
"git.postblue.info/chris/paddockpass/crawlers"
"git.postblue.info/chris/paddockpass/graph"
_ "github.com/go-sql-driver/mysql"
"github.com/urfave/cli"
)
func main() {
year := strconv.Itoa(time.Now().Year())
client, err := graph.ConnectToDgraph()
if err != nil {
panic(err)
}
err = graph.InitSchema(client)
if err != nil {
log.Fatal(err)
}
app := cli.NewApp()
app.Usage = "The hardest way to get your F1 stats."
app.Description = "Run with the docker-compose file and the app will data from Ergast and display it in Dgraph."
fmt.Println("Hello there! It is", year)
crawlers.GetDriversFromErgast(year, client)
// crawlers.GetSeasonFromErgast(year, client)
// crawlers.GetResultsFromErgast(year)
}