From c3a9b25af4a8ecf5f274da93c5c5e6b0fe205b3e Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Sat, 23 Mar 2024 17:10:58 +0000 Subject: [PATCH] add String() function to Game --- football/game.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/football/game.go b/football/game.go index 4968d54..a147fc8 100644 --- a/football/game.go +++ b/football/game.go @@ -1,6 +1,7 @@ package football import ( + "fmt" "time" "git.lehouerou.net/laurent/sorare/graphql" @@ -84,3 +85,14 @@ func (f *Football) NewClubGamesQuery( []string{"football", "club(slug:$slug)"}, ).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, + ) +}