tournaments/tournaments.go
func NewTournament(tdata Info) (*Tournament, error) {
	if err := validateTournamentInfo(tdata); err != nil {
		return nil, errors.New(err.Error() + " - Could not create tournament")
	}

	t := new(Tournament)
	t.UUID, _ = uuid.V4()
	if err := mergo.MergeWithOverwrite(&t.Info, tdata); err != nil {
		return nil, errors.New(err.Error() + " - Could not set initial tournament data")
	}
	// Merge seems to not handle time.Time for some reason, thus fixup
	fixupTournamentInfo(&t.Info, tdata)
	if err := storage.Store(t); err != nil {
		return nil, errors.New(err.Error() + " - Could not write tournament to storage")
	}
	return t, nil
}
func NewTournament(tdata Info) (*Tournament, error) {
	if err := validateTournamentInfo(tdata); err != nil {
		return nil, errors.New(err.Error() + " - Could not create tournament")
	}

	t := new(Tournament)
	t.UUID, _ = uuid.V4()
	if err := mergo.MergeWithOverwrite(&t.Info, tdata); err != nil {
		return nil, errors.New(err.Error() + " - Could not set initial tournament data")
	}
	// Merge seems to not handle time.Time for some reason, thus fixup
	fixupTournamentInfo(&t.Info, tdata)
	if err := storage.Store(t); err != nil {
		return nil, errors.New(err.Error() + " - Could not write tournament to storage")
	}
	return t, nil
}
func NewTournament ( tdata Info ) ( * Tournament , error ) { if err := validateTournamentInfo ( tdata ) ; err != nil { return nil , errors . New ( err . Error ( ) + " " ) } t := new ( Tournament ) t . UUID , _ = uuid . V4 ( ) if err := mergo . MergeWithOverwrite ( & t . Info , tdata ) ; err != nil { return nil , errors . New ( err . Error ( ) + " " ) } // Merge seems to not handle time.Time for some reason, thus fixup fixupTournamentInfo ( & t . Info , tdata ) if err := storage . Store ( t ) ; err != nil { return nil , errors . New ( err . Error ( ) + " " ) } return t , nil }
// Create a Tournament
Create a Tournament