Documentation
¶
Index ¶
- Variables
- func Hash(password string) ([]byte, error)
- func VerifyPassword(hashedPassword, password string) error
- type Base
- type Error
- type Errors
- type GenerateTeamRequest
- type Health
- type Player
- type SkillMap
- type SkillWeightMap
- type Sport
- type SportList
- type Team
- type TeamSet
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteAUser(db *gorm.DB, uid uint32) (int64, error)
- func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)
- func (u *User) FindUserByID(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Prepare()
- func (u *User) SaveUser(db *gorm.DB) (*User, error)
- func (u *User) UpdateAUser(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Validate(action string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var InitialSports = []Sport{
ultimateFrisbee,
basketball,
football,
}
Functions ¶
func VerifyPassword ¶
Types ¶
type Base ¶
type Base struct {
ID xid.ID `gorm:"type:varchar(20);primary_key;" json:"id"`
Name string `gorm:"type:varchar(50);unique" json:"name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
Base is the collection of fields all types in the Skillbased architecture have
type Error ¶
type Error struct {
Status int `json:"status"`
Message string `json:"message"`
Detail string `json:"detail"`
RequestID string `json:"request_id"`
}
Error contains the details of a specific error
func GenNotFoundError ¶
GenNotFoundError generates a "not found" HTTP error to return to a caller
type Errors ¶
type Errors struct {
Errors []Error `json:"errors"`
}
Errors is the collection of errors returned to a caller
type GenerateTeamRequest ¶
type SkillWeightMap ¶
type Sport ¶
type Sport struct {
Base
SkillWeights SkillWeightMap `gorm:"-" json:"skills"` // Ignore this field for DB
SkillWeightsDB postgres.Jsonb `json:"-"` // Ignore this field for JSON
MaxPlayersPerTeam int `json:"max_players_per_team"`
}
type Team ¶
type Team struct {
Base
// Sport is the "parent" sport that this team was created for
Sport Sport `json:"sport"`
// PowerScore is the overall "ranking" of this team based on it's player's skills for the given sport, and the
// weights that sport gives them
PowerScore float32 `json:"power_score"`
// Players is the list of players for this team
Players []Player `json:"players"`
}
Team is a representation of a group of players for a single sport
type TeamSet ¶
type TeamSet struct {
// User provided name to reference
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
ID string `json:"id"`
Sport Sport `json:"sport"`
Teams []Team `json:"teams"`
}
TeamSet is the "output" of the team generation algorithm, which represents the collection of teams for a specific sport or season
type User ¶
type User struct {
ID uint32 `gorm:"primary_key;auto_increment" json:"id"`
Username string `gorm:"size:255;not null;unique" json:"username"`
Email string `gorm:"size:100;not null;unique" json:"email"`
Password string `gorm:"size:100;not null;" json:"password"`
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}
func (*User) BeforeSave ¶
Click to show internal directories.
Click to hide internal directories.