populate both tables in loop

This commit is contained in:
Ravi Prasad
2025-04-30 22:49:38 -05:00
parent 80e4823b35
commit e3c8c76f35
15 changed files with 506 additions and 32 deletions
+36
View File
@@ -0,0 +1,36 @@
package models
import "gorm.io/gorm"
type PlayerAdvancedStat struct {
gorm.Model
ExternalID int `json:"id"`
PlayerID string `gorm:"not null;uniqueIndex:idx_player_season_team" json:"playerId"`
PlayerName string `json:"playerName"`
Position string `json:"position"`
Age int `json:"age"`
Games int `json:"games"`
MinutesPlayed int `json:"minutesPlayed"`
PER float64 `json:"per"`
TSPercent float64 `json:"tsPercent"`
ThreePAR float64 `json:"threePAR"`
FTR float64 `json:"ftr"`
OffensiveRBPercent float64 `json:"offensiveRBPercent"`
DefensiveRBPercent float64 `json:"defensiveRBPercent"`
TotalRBPercent float64 `json:"totalRBPercent"`
AssistPercent float64 `json:"assistPercent"`
StealPercent float64 `json:"stealPercent"`
BlockPercent float64 `json:"blockPercent"`
TurnoverPercent float64 `json:"turnoverPercent"`
UsagePercent float64 `json:"usagePercent"`
OffensiveWS float64 `json:"offensiveWS"`
DefensiveWS float64 `json:"defensiveWS"`
WinShares float64 `json:"winShares"`
WinSharesPer float64 `json:"winSharesPer"`
OffensiveBox float64 `json:"offensiveBox"`
DefensiveBox float64 `json:"defensiveBox"`
Box float64 `json:"box"`
VORP float64 `json:"vorp"`
Team string `gorm:"not null;uniqueIndex:idx_player_season_team" json:"team"`
Season int `gorm:"not null;uniqueIndex:idx_player_season_team" json:"season"`
}
+39
View File
@@ -0,0 +1,39 @@
package models
import "gorm.io/gorm"
type PlayerTotalStat struct {
gorm.Model
ExternalID int `json:"id"`
PlayerID string `gorm:"not null;uniqueIndex:idx_total_player_season_team" json:"playerId"`
PlayerName string `json:"playerName"`
Position string `json:"position"`
Age int `json:"age"`
Games int `json:"games"`
GamesStarted int `json:"gamesStarted"`
MinutesPG float64 `json:"minutesPg"`
FieldGoals int `json:"fieldGoals"`
FieldAttempts int `json:"fieldAttempts"`
FieldPercent float64 `json:"fieldPercent"`
ThreeFG int `json:"threeFg"`
ThreeAttempts int `json:"threeAttempts"`
ThreePercent float64 `json:"threePercent"`
TwoFG int `json:"twoFg"`
TwoAttempts int `json:"twoAttempts"`
TwoPercent float64 `json:"twoPercent"`
EffectFGPercent float64 `json:"effectFgPercent"`
FT int `json:"ft"`
FTAttempts int `json:"ftAttempts"`
FTPercent float64 `json:"ftPercent"`
OffensiveRB int `json:"offensiveRb"`
DefensiveRB int `json:"defensiveRb"`
TotalRB int `json:"totalRb"`
Assists int `json:"assists"`
Steals int `json:"steals"`
Blocks int `json:"blocks"`
Turnovers int `json:"turnovers"`
PersonalFouls int `json:"personalFouls"`
Points int `json:"points"`
Team string `gorm:"not null;uniqueIndex:idx_total_player_season_team" json:"team"`
Season int `gorm:"not null;uniqueIndex:idx_total_player_season_team" json:"season"`
}