paddockpass/main.go

37 lines
778 B
Go
Raw Normal View History

2019-09-03 23:05:07 +02:00
package main
import (
"fmt"
2020-07-24 20:17:25 +02:00
"log"
2020-02-04 20:16:42 +01:00
"strconv"
"time"
2019-09-03 23:05:07 +02:00
2020-07-25 00:39:53 +02:00
"git.postblue.info/chris/paddockpass/crawlers"
"git.postblue.info/chris/paddockpass/graph"
2019-09-03 23:05:07 +02:00
_ "github.com/go-sql-driver/mysql"
"github.com/urfave/cli"
2019-09-03 23:05:07 +02:00
)
func main() {
2020-02-05 19:14:19 +01:00
year := strconv.Itoa(time.Now().Year())
2020-07-25 00:39:53 +02:00
client, err := graph.ConnectToDgraph()
if err != nil {
panic(err)
}
err = graph.InitSchema(client)
if err != nil {
log.Fatal(err)
}
2020-02-05 19:14:19 +01:00
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."
2020-02-04 20:16:42 +01:00
fmt.Println("Hello there! It is", year)
2020-07-26 22:59:23 +02:00
crawlers.GetDriversFromErgast(year, client)
2020-07-28 00:01:06 +02:00
// crawlers.GetSeasonFromErgast(year, client)
2020-07-25 00:39:53 +02:00
// crawlers.GetResultsFromErgast(year)
2019-09-03 23:05:07 +02:00
}