seeds

package
v0.0.0-...-b8f7dfc Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFargoHotHandicap

func CreateFargoHotHandicap(db *gorm.DB, id uint, raceTo int, differenceStart uint, differenceEnd *uint, winsHigher uint, winsLower uint) error

CreateFargoHotHandicap adds a handicap to the database.

func CreateFlag

func CreateFlag(db *gorm.DB, id uint, country string, imagePath string) error

CreateFlag adds a flag to the database.

func CreatePlayer

func CreatePlayer(db *gorm.DB, id uint, name string, flagID uint, fargoID uint, fargoRating uint) error

CreatePlayer adds a player to the database.

func CreateTeam

func CreateTeam(db *gorm.DB, id uint, name string) error

CreateTeam adds a team to the database.

func CreateTeamPlayer

func CreateTeamPlayer(db *gorm.DB, id uint, teamID uint, playerID uint) error

CreateTeamPlayer adds a team player to the database.

func Run

func Run(db *gorm.DB, seeders ...Seeder) error

Run takes a variadic number of loaders and runs all of their seeds.

Types

type FargoHotHandicapSeed

type FargoHotHandicapSeed struct {
	Handicaps []models.FargoHotHandicap
}

FargoHotHandicapSeed is used to load all handicap seeds from the json file.

func NewFargoHotHandicapSeed

func NewFargoHotHandicapSeed(jsonPath ...string) *FargoHotHandicapSeed

NewFargoHotHandicapSeed return a new FargoHotHandicapSeed.

func (*FargoHotHandicapSeed) Seeds

func (s *FargoHotHandicapSeed) Seeds() []Seed

Seeds returns all handicaps loaded from the json file as seeds.

type FlagSeed

type FlagSeed struct {
	Flags []models.Flag
}

FlagSeed is used to load all flag seeds from the json file.

func NewFlagSeed

func NewFlagSeed(jsonPath ...string) *FlagSeed

NewFlagSeed return a new FlagSeed.

func (*FlagSeed) Seeds

func (f *FlagSeed) Seeds() []Seed

Seeds returns all flags loaded from the json file as seeds.

type PlayerSeed

type PlayerSeed struct {
	Players []models.Player
}

PlayerSeed is used to load all player seeds from the json file.

func NewPlayerSeed

func NewPlayerSeed(jsonPath ...string) *PlayerSeed

NewPlayerSeed return a new PlayerSeed.

func (*PlayerSeed) Seeds

func (s *PlayerSeed) Seeds() []Seed

Seeds returns all flags loaded from the json file as seeds.

type Seed

type Seed struct {
	Name string
	Run  func(*gorm.DB) error
}

Seed is a database entry to be added.

type Seeder

type Seeder interface {
	Seeds() []Seed
}

Seeder is used to load a json seed file and return the seed slice.

type TeamPlayerSeed

type TeamPlayerSeed struct {
	TeamPlayers []models.TeamPlayer
}

TeamPlayerSeed is used to load all team player seeds from the json file.

func NewTeamPlayerSeed

func NewTeamPlayerSeed(jsonPath ...string) *TeamPlayerSeed

NewTeamPlayerSeed return a new TeamPlayerSeed.

func (*TeamPlayerSeed) Seeds

func (s *TeamPlayerSeed) Seeds() []Seed

Seeds returns all teams loaded from the json file as seeds.

type TeamSeed

type TeamSeed struct {
	Teams []models.Team
}

TeamSeed is used to load all player seeds from the json file.

func NewTeamSeed

func NewTeamSeed(jsonPath ...string) *TeamSeed

NewTeamSeed return a new TeamSeed.

func (*TeamSeed) Seeds

func (s *TeamSeed) Seeds() []Seed

Seeds returns all teams loaded from the json file as seeds.

Jump to

Keyboard shortcuts

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