db

package
v0.0.0-...-6dace06 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DSNFromOptions

func DSNFromOptions(opts Options) string

func GetAllTeams

func GetAllTeams(db *gorm.DB, year int) int

func GetName

func GetName(db *gorm.DB, teamID int) string

func Migrate

func Migrate(db *gorm.DB)

func NewDB

func NewDB(opts Options) *gorm.DB

Types

type Game

type Game struct {
	gorm.Model

	HomeID     int
	Home       Team
	HomePoints int
	AwayID     int
	Away       Team
	AwayPoints int

	Completed bool
	Tie       bool

	Date time.Time

	WeekID int
	Week   Week
	YearID int
	Year   Year
}

func GetGames

func GetGames(db *gorm.DB, year int) []Game

type Options

type Options struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
	Args     string
}

type Team

type Team struct {
	gorm.Model

	Name     string
	Nickname string
}

func GetTeamsInASeason

func GetTeamsInASeason(db *gorm.DB, year int) []Team

type Week

type Week struct {
	gorm.Model

	Week int

	YearID int
	Year   Year
}

func GetWeeks

func GetWeeks(db *gorm.DB, year int) []Week

type Year

type Year struct {
	gorm.Model
	Year int `gorm:"index:unqiue,"`
}

func GetYear

func GetYear(db *gorm.DB, year int) Year

Jump to

Keyboard shortcuts

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