optomization in getting game system

This commit is contained in:
2026-01-28 05:39:51 +01:00
parent c77f5202b6
commit 34c6e31200
5 changed files with 89 additions and 26 deletions
+20
View File
@@ -0,0 +1,20 @@
package gsmaster
import "bamort/models"
func GetGameSystem(id int, name string) *models.GameSystem {
gs := &models.GameSystem{}
if id == 0 && name == "" {
gs.GetDefault()
return gs
}
if id == 0 && name != "" {
gs.FirstByCode(name)
if gs.ID == 0 {
gs.FirstByName(name)
}
return gs
}
gs.FirstByID(uint(id))
return gs
}