func Open(dialect string, addr string, filestoragePath string) (*api.Services, error) { conn, err := migration.Open(dialect, addr, migrations.Migrations) if err != nil { return nil, err } db, err := gorm.Open(dialect, conn) if err != nil { return nil, err } r := &resources{ DB: &db, Ports: operator.NewScheduler(16000, 2000), FilestoragePath: filestoragePath, } s := &api.Services{ Rankings: &rankingsDB{r}, Games: &gamesDB{r}, Matches: &matchesDB{r}, Players: &playersDB{r}, Users: &usersDB{r}, DB: &db, } r.Services = s return s, nil }
func main() { flag.Parse() scheduler := operator.NewScheduler(14000, 100) fmt.Println(flag.Arg(0)) err := operator.Validate(flag.Arg(0), scheduler) if err != nil { fmt.Println("Validation Failed!") fmt.Println(err) } else { fmt.Println("Validation succeeded") } }