From 2a62f1f8c775e9c0a7c8c14f06aef7a591d383ca Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Thu, 27 Oct 2022 23:31:39 +0300 Subject: [PATCH] refactor games utils --- {game => gameUtils}/gameTypes.go | 2 +- {game => gameUtils}/gameUtils.go | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) rename {game => gameUtils}/gameTypes.go (96%) rename {game => gameUtils}/gameUtils.go (66%) diff --git a/game/gameTypes.go b/gameUtils/gameTypes.go similarity index 96% rename from game/gameTypes.go rename to gameUtils/gameTypes.go index 4fdfe61..6e8bc7b 100644 --- a/game/gameTypes.go +++ b/gameUtils/gameTypes.go @@ -1,4 +1,4 @@ -package game +package gameUtils type SteamGame struct { GameId string diff --git a/game/gameUtils.go b/gameUtils/gameUtils.go similarity index 66% rename from game/gameUtils.go rename to gameUtils/gameUtils.go index e50e182..b92cda2 100644 --- a/game/gameUtils.go +++ b/gameUtils/gameUtils.go @@ -1,14 +1,14 @@ -package game +package gameUtils -// func findGameByID(id string) SteamGame { -// for _, game := range GamesList { -// if game.GameId == id { -// return game -// } -// } -// var temp SteamGame = SteamGame{} -// return temp -// } +func FindGameByID(id string, list Games) SteamGame { + for _, game := range list.SteamGames { + if game.GameId == id { + return game + } + } + var temp SteamGame = SteamGame{} + return temp +} // func findSteamGameByID(id string) SteamGame { // for _, game := range localGames.St { @@ -20,8 +20,6 @@ package game // return game // } -func FindGameByID() {} - func GetJSGameInterface(game SteamGame) JSGameInterface { newInterface := JSGameInterface{ GameID: game.GameId,