db

package
v0.0.0-...-554ec09 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AddTeamPlaceholder

func AddTeamPlaceholder(team Team) error

func CreateRing

func CreateRing(ringData Ring) error

CreateRing creates a ring. You must use the Ring struct to create the ring, unlike the other create functions as this one is small and simple.

func DropPlayer

func DropPlayer(playerData *Player, teamData *Team) error

func EditRing

func EditRing(id string, ringData Ring) error

EditRing edits the data of a ring. You must use the Ring struct to edit the data, unlike the other edit functions as this one is small and simple.

func HasManagePermission

func HasManagePermission(userID string, team Team) bool

func Init

func Init()

func RecruitPlayer

func RecruitPlayer(playerData *Player, teamData *Team) error

func SavePlayerData

func SavePlayerData(playerData *Player) error

func SaveTeamData

func SaveTeamData(teamData *Team) error

func UpdateTeamOptions

func UpdateTeamOptions() error

Types

type Player

type Player struct {
	ID          string           `bson:"_id"`
	TeamPlaying string           `bson:"team_id"`
	Stars       float32          `bson:"stars"`
	Contracted  bool             `bson:"contracted"`
	Suspension  *Suspension      `bson:"suspension"`
	Rings       []PlayerRingData `bson:"rings"`
}

func GetPlayerData

func GetPlayerData(id string) (Player, error)

func GetPlayersWithRing

func GetPlayersWithRing(ringID string) ([]Player, error)

GetPlayersWithRing returns the players with a specific ring.

func GetSpecificPlayerData

func GetSpecificPlayerData(id string, projection bson.M) (Player, error)

type PlayerInfo

type PlayerInfo struct {
	ID    string  `bson:"player_id"`
	Stars float32 `bson:"stars"`
}

type PlayerRingData

type PlayerRingData struct {
	RingID      string `bson:"ring_id"`
	DateAwarded string `bson:"date_awarded"`
}

func GetPlayerRings

func GetPlayerRings(id string) ([]PlayerRingData, error)

GetPlayerRings returns the rings of a player.

type Ring

type Ring struct {
	ID     string `bson:"_id"`
	RoleID string `bson:"roleId"`
	Name   string `bson:"name"`
	Desc   string `bson:"desc"`
}

TODO: implement discord invites for teams in teams.go and wherever else it's needed (i forgort lol)

func GetPlayerRingsData

func GetPlayerRingsData(id string) ([]Ring, error)

GetPlayerRingsData returns the data of the rings of a player.

func GetRingData

func GetRingData(id string) (Ring, error)

GetRingData returns the data of a single ring. To get the data of multiple rings, use GetRingsData.

func GetRingsData

func GetRingsData() ([]Ring, error)

GetRingsData returns the data of all rings.

type Suspension

type Suspension struct {
	WhoSuspended string    `bson:"who_suspended"`
	Reason       string    `bson:"reason"`
	Started      time.Time `bson:"started"`
	Ends         int64     `bson:"ends"`
	Active       bool      `bson:"active"`
}

type Team

type Team struct {
	ID            string       `bson:"_id"`
	Name          string       `bson:"name"`
	EmojiID       string       `bson:"emojiId"`
	Owner         string       `bson:"teamOwner"`
	Coaches       []string     `bson:"coach"`
	Players       []PlayerInfo `bson:"players"`
	PlayerMax     int          `bson:"playerMax"`
	RoleID        string       `bson:"roleId"`
	Wins          uint         `bson:"wins"`
	Losses        uint         `bson:"losses"`
	MaxStars      float32      `bson:"maxStars"`
	DiscordInvite string       `bson:"discordInvite"`
}

func GetAllTeams

func GetAllTeams() ([]Team, error)

func GetTeamData

func GetTeamData(id string) (Team, error)

Jump to

Keyboard shortcuts

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