add json method to gameUtils

This commit is contained in:
cyber-dream 2022-10-28 15:27:57 +03:00
parent 073c0b8e90
commit 6f3f3e1d8f

View File

@ -1,5 +1,9 @@
package gameUtils package gameUtils
import (
"encoding/json"
)
func FindGameByID(id string, list Games) SteamGame { func FindGameByID(id string, list Games) SteamGame {
for _, game := range list.SteamGames { for _, game := range list.SteamGames {
if game.GameId == id { if game.GameId == id {
@ -29,3 +33,9 @@ func GetJSGameInterface(game SteamGame) JSGameInterface {
} }
return newInterface return newInterface
} }
func ConvertServerGamesToJSON(g Games) []byte {
g_json, err := json.Marshal(g)
_ = err //TODO: Check Errors
return g_json
}