package model import ( "fmt" "time" ) type GameID string type Game struct { ID GameID `json:"id"` Added time.Time `json:"added"` Author PlayerID `json:"author"` Team0Player0 PlayerID `json:"t0p0"` Team0Player1 PlayerID `json:"t0p1"` Team1Player0 PlayerID `json:"t1p0"` Team1Player1 PlayerID `json:"t1p1"` Score int `json:"score"` Overtime bool `jsone:"ot"` } func (id *GameID) Scan(src any) error { switch v := src.(type) { case int64: *id = GameID(fmt.Sprintf("%d", v)) return nil case string: *id = GameID(v) return nil default: return fmt.Errorf("unsupported type %T for GameID", src) } }