db

package
v0.0.0-...-652a4c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSha256FromByteArray

func ComputeSha256FromByteArray(arr []byte) string

Types

type Action

type Action struct {
	TeamNumber  string `gorm:"primaryKey"`
	MatchNumber int32  `gorm:"primaryKey"`
	SetNumber   int32  `gorm:"primaryKey"`
	CompLevel   string `gorm:"primaryKey"`
	CompType    string `gorm:"primaryKey"`
	// This contains a serialized scouting.webserver.requests.ActionType flatbuffer.
	CompletedAction []byte
	Timestamp       int64 `gorm:"primaryKey"`
	CollectedBy     string
}

type Database

type Database struct {
	*gorm.DB
}

func NewDatabase

func NewDatabase(user string, password string, port int) (*Database, error)

Opens a database at the specified port on localhost. We currently don't support connecting to databases on other hosts.

func (*Database) AddAction

func (database *Database) AddAction(a Action) error

func (*Database) AddDriverRanking

func (database *Database) AddDriverRanking(data DriverRankingData) error

func (*Database) AddNotes

func (database *Database) AddNotes(data NotesData) error

func (*Database) AddOrUpdateRankings

func (database *Database) AddOrUpdateRankings(r Ranking) error

func (*Database) AddParsedDriverRanking

func (database *Database) AddParsedDriverRanking(data ParsedDriverRankingData) error

func (*Database) AddPitImage

func (database *Database) AddPitImage(p PitImage) error

func (*Database) AddToMatch

func (database *Database) AddToMatch(m TeamMatch) error

func (*Database) AddToShift

func (database *Database) AddToShift(sh Shift) error

func (*Database) AddToStats2023

func (database *Database) AddToStats2023(s Stats2023) error

func (*Database) AddToStats2024

func (database *Database) AddToStats2024(s Stats2024) error

func (*Database) Delete

func (database *Database) Delete() error

func (*Database) DeleteFromActions

func (database *Database) DeleteFromActions(compLevel_ string, matchNumber_ int32, setNumber_ int32, teamNumber_ string) error

func (*Database) DeleteFromStats

func (database *Database) DeleteFromStats(compLevel_ string, matchNumber_ int32, setNumber_ int32, teamNumber_ string) error

func (*Database) DeleteFromStats2024

func (database *Database) DeleteFromStats2024(compLevel_ string, matchNumber_ int32, setNumber_ int32, teamNumber_ string) error

func (*Database) QueryActions

func (database *Database) QueryActions(teamNumber_ string) ([]Action, error)

func (*Database) QueryAllShifts

func (database *Database) QueryAllShifts(matchNumber_ int) ([]Shift, error)

func (*Database) QueryDriverRanking

func (database *Database) QueryDriverRanking(MatchNumber int) ([]DriverRankingData, error)

func (*Database) QueryMatchesString

func (database *Database) QueryMatchesString(teamNumber_ string) ([]TeamMatch, error)

func (*Database) QueryNotes

func (database *Database) QueryNotes(TeamNumber string) ([]string, error)

func (*Database) QueryPitImageByChecksum

func (database *Database) QueryPitImageByChecksum(checksum_ string) (PitImage, error)

func (*Database) QueryPitImages

func (database *Database) QueryPitImages(teamNumber_ string) ([]RequestedPitImage, error)

func (*Database) QueryRankings

func (database *Database) QueryRankings(TeamNumber string) ([]Ranking, error)

func (*Database) ReturnActions

func (database *Database) ReturnActions() ([]Action, error)

func (*Database) ReturnAllDriverRankings

func (database *Database) ReturnAllDriverRankings() ([]DriverRankingData, error)

func (*Database) ReturnAllNotes

func (database *Database) ReturnAllNotes() ([]NotesData, error)

func (*Database) ReturnAllParsedDriverRankings

func (database *Database) ReturnAllParsedDriverRankings() ([]ParsedDriverRankingData, error)

func (*Database) ReturnAllShifts

func (database *Database) ReturnAllShifts() ([]Shift, error)

func (*Database) ReturnMatches

func (database *Database) ReturnMatches() ([]TeamMatch, error)

func (*Database) ReturnPitImages

func (database *Database) ReturnPitImages() ([]PitImage, error)

func (*Database) ReturnRankings

func (database *Database) ReturnRankings() ([]Ranking, error)

func (*Database) ReturnStats2023

func (database *Database) ReturnStats2023() ([]Stats2023, error)

func (*Database) ReturnStats2023ForTeam

func (database *Database) ReturnStats2023ForTeam(teamNumber string, matchNumber int32, setNumber int32, compLevel string, preScouting bool) ([]Stats2023, error)

func (*Database) ReturnStats2024

func (database *Database) ReturnStats2024() ([]Stats2024, error)

func (*Database) ReturnStats2024ForTeam

func (database *Database) ReturnStats2024ForTeam(teamNumber string, matchNumber int32, setNumber int32, compLevel string, compType string) ([]Stats2024, error)

func (*Database) SetDebugLogLevel

func (database *Database) SetDebugLogLevel()

type DriverRankingData

type DriverRankingData struct {
	ID          uint `gorm:"primaryKey"`
	MatchNumber int32
	Rank1       string
	Rank2       string
	Rank3       string
}

type NotesData

type NotesData struct {
	ID             uint `gorm:"primaryKey"`
	TeamNumber     string
	MatchNumber    int32
	SetNumber      int32
	CompLevel      string
	Notes          string
	GoodDriving    bool
	BadDriving     bool
	SolidPlacing   bool
	SketchyPlacing bool
	GoodDefense    bool
	BadDefense     bool
	EasilyDefended bool
	NoShow         bool
}

type ParsedDriverRankingData

type ParsedDriverRankingData struct {
	TeamNumber string `gorm:"primaryKey"`

	// The score of the team. A difference of 100 in two team's scores
	// indicates that one team will outperform the other in 90% of the
	// matches.
	Score float32
}

type PitImage

type PitImage struct {
	TeamNumber string `gorm:"primaryKey"`
	CheckSum   string `gorm:"primaryKey"`
	ImagePath  string
	ImageData  []byte
}

type Ranking

type Ranking struct {
	TeamNumber         string `gorm:"primaryKey"`
	Losses, Wins, Ties int32
	Rank, Dq           int32
}

type RequestedPitImage

type RequestedPitImage struct {
	TeamNumber string
	CheckSum   string `gorm:"primaryKey"`
	ImagePath  string
}

type Shift

type Shift struct {
	MatchNumber                                                      int32 `gorm:"primaryKey"`
	R1scouter, R2scouter, R3scouter, B1scouter, B2scouter, B3scouter string
}

type Stats2023

type Stats2023 struct {
	// This is set to `true` for "pre-scouted" matches. This means that the
	// match information is unlikely to correspond with an entry in the
	// `TeamMatch` table.
	PreScouting bool `gorm:"primaryKey"`

	TeamNumber                                                     string `gorm:"primaryKey"`
	MatchNumber                                                    int32  `gorm:"primaryKey"`
	SetNumber                                                      int32  `gorm:"primaryKey"`
	CompLevel                                                      string `gorm:"primaryKey"`
	StartingQuadrant                                               int32
	LowCubesAuto, MiddleCubesAuto, HighCubesAuto, CubesDroppedAuto int32
	LowConesAuto, MiddleConesAuto, HighConesAuto, ConesDroppedAuto int32
	LowCubes, MiddleCubes, HighCubes, CubesDropped                 int32
	LowCones, MiddleCones, HighCones, ConesDropped                 int32
	SuperchargedPieces                                             int32
	AvgCycle                                                       int64
	Mobility                                                       bool
	DockedAuto, EngagedAuto, BalanceAttemptAuto                    bool
	Docked, Engaged, BalanceAttempt                                bool

	// The username of the person who collected these statistics.
	// "unknown" if submitted without logging in.
	// Empty if the stats have not yet been collected.
	CollectedBy string
}

type Stats2024

type Stats2024 struct {
	TeamNumber                                  string `gorm:"primaryKey"`
	MatchNumber                                 int32  `gorm:"primaryKey"`
	SetNumber                                   int32  `gorm:"primaryKey"`
	CompLevel                                   string `gorm:"primaryKey"`
	CompType                                    string `gorm:"primaryKey"`
	StartingQuadrant                            int32
	SpeakerAuto, AmpAuto                        int32
	NotesDroppedAuto                            int32
	MobilityAuto                                bool
	Speaker, Amp, SpeakerAmplified              int32
	NotesDropped                                int32
	Shuttled, OutOfField                        int32
	Penalties                                   int32
	AvgCycle                                    int64
	RobotDied                                   bool
	Park, OnStage, Harmony, TrapNote, Spotlight bool
	NoShow                                      bool

	// The username of the person who collected these statistics.
	// "unknown" if submitted without logging in.
	// Empty if the stats have not yet been collected.
	CollectedBy string
}

type TeamMatch

type TeamMatch struct {
	MatchNumber      int32  `gorm:"primaryKey"`
	SetNumber        int32  `gorm:"primaryKey"`
	CompLevel        string `gorm:"primaryKey"`
	Alliance         string `gorm:"primaryKey"` // "R" or "B"
	AlliancePosition int32  `gorm:"primaryKey"` // 1, 2, or 3
	TeamNumber       string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL