sumomodel

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: MIT Imports: 7 Imported by: 2

README

sumomodel

originally from sumoscrape. I am moving it into its own repo so I can used it in mutliple projects.

WIP

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortBouts

func SortBouts(b []Bout) error

SortBouts sorts bouts by bashoId, day, then bout number.

func SortRikishiByRank

func SortRikishiByRank(r []Rikishi) error

SortRikishiByRank takes a list of Rikishi's and sorts it by rank.

Types

type Bout

type Bout struct {
	BashoID         int
	Day             int
	Boutnum         int
	Division        int
	EastRikishiID   int
	EastRikishiName string
	EastWin         bool
	WestRikishiID   int
	WestRikishiName string
	WestWin         bool
	Kimarite        string
}

Bout represents a single bout between two rikishi.

func (*Bout) PrintData

func (b *Bout) PrintData()

PrintData prints the data for the Bout struct

type Division

type Division struct {
	ID          int
	DivLongName string
	ShortName   string
	RankRegex   string
}

Division Represents a division of sumo wrestlers. Each division contains an ID, the full name, a short version of the name, and a Regex string used to confirm if a rank is in said division.

func GetDivision

func GetDivision(str string) (Division, error)

GetDivision returns the requested division if it exists, or nil if it doesnt. Divisions can be requested by either their short or long forms

func GetDivisionByRank

func GetDivisionByRank(rank string) (Division, error)

GetDivisionByRank Checks the provided rank string against the rank regex of the divisions. returns the division and nil if the rank string matches any regex pattern.

func GetDivisionList

func GetDivisionList(list []string) ([]Division, error)

GetDivisionList takes in a list of requested divisions and

type Rank

type Rank struct {
	Name     string
	Num      int
	Side     string
	Overhang string
}

Rank is a model used to make it easier to compare rikishi. it is not used in the rikishi model because strings suffice in most situations.

func CreateRankModelFromString

func CreateRankModelFromString(str string) (Rank, error)

CreateRankModelFromString takes a string and attempts to convert it into a rank struct. will return an error if anything in the process goes wrong.

type Rikishi

type Rikishi struct {
	Id         int
	Name       string
	Rank       string
	Heya       string
	Shusshin   string
	HW         string
	Result     string
	Kanji      string
	Dob        string
	Firstbasho string
	Lastbasho  string
	Division   int
	BashoID    int
}

Rikishi data struct.

func (*Rikishi) PrintData

func (r *Rikishi) PrintData()

PrintData prints some of the rikishi structs data as a test.

Jump to

Keyboard shortcuts

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