add String() function to Game

This commit is contained in:
Laurent Le Houerou 2024-03-23 17:10:58 +00:00
parent b99d855805
commit c3a9b25af4

View File

@ -1,6 +1,7 @@
package football package football
import ( import (
"fmt"
"time" "time"
"git.lehouerou.net/laurent/sorare/graphql" "git.lehouerou.net/laurent/sorare/graphql"
@ -84,3 +85,14 @@ func (f *Football) NewClubGamesQuery(
[]string{"football", "club(slug:$slug)"}, []string{"football", "club(slug:$slug)"},
).WithQueryParam("slug", clubSlug) ).WithQueryParam("slug", clubSlug)
} }
func (g *Game) String() string {
return fmt.Sprintf(
"%s | %s %d - %d %s",
g.Date.Format("2006-01-02"),
g.HomeTeam.Team.Slug,
g.HomeGoals,
g.AwayGoals,
g.AwayTeam.Team.Slug,
)
}